Community Forums › Forums › Archived Forums › General Discussion › add custom fields to front-page.php
Tagged: ACF, advanced custom fields, Custom fields
- This topic has 19 replies, 5 voices, and was last updated 5 years, 9 months ago by canpress5.
-
AuthorPosts
-
June 5, 2018 at 1:39 pm #220590canpress5Member
I would like to add custom fields to the Infnity Pro home page (front-page.php) because I believe custom fields are easier to edit (for a client) than the home page widget areas.
How can custom fields (or Advanced Custom Fields) be added to a Genesis home page (front-page.php)?
I know how to add custom fields to any other page, and can add the necessary code to the front-page.php file, but I am unsure where I would edit the custom fields.
EG If I want to edit custom fields on any regular page, I simply go to edit that page and the custom fields can be edited in the same location.
Where would I edit custom fields for front-page.php?I am using Infinity Pro, but this question relates to Studiopress themes in general.
Thanks in advance.
June 5, 2018 at 2:58 pm #220592Victor FontModeratorFront-page.php doesn't exist as a standard page. You can copy front-page.php and make into a page template, then assign that page template to a static front page. That should give you what you want.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?June 5, 2018 at 3:23 pm #220593canpress5MemberThank you for your help Victor!
Are there any downsides to using a page template/static front page instead of front-page.php for the home page?
June 6, 2018 at 4:26 am #220603Victor FontModeratorNo downsides.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?June 6, 2018 at 6:23 am #220604TerryMemberHi,
For ACF, you can create an "Admin" page containing the fields they need to edit. That way the client has a one stop and it's much less confusing.
I've used approach successfully to make life easier for clients. Just depends on the fields.
Hope that helps,
TerryJune 6, 2018 at 8:06 am #220606canpress5MemberTerry,
Do you mean an Admin page with custom fields just for the home page, or with custom fields for other areas of the site too?
Thanks!
June 6, 2018 at 8:46 am #220608TerryMemberFor whatever it makes sense.
Sometimes it can be easier to create that one page for the client but it depends on the fields.
June 6, 2018 at 9:56 am #220609canpress5MemberSo you can create one admin page which contains custom fields for several different pages?
Is this done using the Options Page, as seen here?Or another method?
June 6, 2018 at 10:42 am #220610TerryMemberYes, Options Page provides a clean, pretty interface for this.
Depending on the fields - where/how they're being used - I sometimes just create a page and configure the fields to display there. Then direct the client to that page.
Sorry to take the forum off in another direction, know our focus is Genesis. Just couldn't resist to post because it's been very helpful to some clients.
Best of luck, hope it helps!
June 6, 2018 at 10:49 am #220611Andrea RennickMemberAlso stopping in to note front-page.php is not specific to Genesis.
It's part of the WordPress template hierarchy.
https://developer.wordpress.org/themes/basics/template-hierarchy/#front-page-display
**forum signature**
If you need technical support for your theme please file a ticket.The forums are community based. Staff only monitors the forum for issues relating to the forum itself and to redirect users to where they need to go.
June 6, 2018 at 11:17 am #220612canpress5MemberDepending on the fields - where/how they're being used - I sometimes just create a page and configure the fields to display there.
Do you mind pointing me in the right direction for how to build/configure such a page?
Thanks!
June 6, 2018 at 12:58 pm #220614TerryMemberGoing back to your original post, you want to do two things - provide an interface to set/modify fields and then to operate on/display/manipulate fields in your home page.
What I'm referring to is the interface to set/modify fields, you'll still need to create a template file to display the fields.
To create the interface to set/modify fields, create a new page (Client Settings). In ACF Location Rules set field to display when the page is Client Settings.
Then within your front-page.php can operate on/display/manipulate the fields for use in your static font page.
Hope that helps!
June 6, 2018 at 2:59 pm #220617canpress5MemberHi Terry,
I really appreciate your help with this, thank you!
I understand how to set up a page with the required custom fields for my static home page, and I can set up the template for that static home page. So my original question from this post is answered.
What is not clear to me is how to set up your single Client Settings page to edit custom fields for multiple pages, eg the home page plus other pages. I've tried several Google searches but can't seem to find any reference to that?
June 7, 2018 at 8:15 am #220630TerryMemberPossibly this can help...
Our goal is to create a page with two new ACF fields (Field Groups) and then view the page in the WordPress Admin to edit your ACF fields.1. Create that new page "Client Settings"
2. Create a new ACF Field Group, say Color One.
Add a Field, set it up and under the Field Type set it to JQuery => Color Picker (Just to have a little fun).
Set up the Location Rules - Show this field group if "Page" "is equal to" "Client Settings"
Customize the options as you'd like & Update.
3. Create a new ACF Field Group, say Color Two.
Add a Field, set it up and under the Field Type set it to JQuery => Color Picker (Just to have a little fun).
Set up the Location Rules - Show this field group if "Page" "is equal to" "Client Settings"
Customize the options as you'd like & Update.
4. Open your page Pages => All Pages => "Client Settings" and observe the two ACF fields are displayed (per your Options selections). Edit the fields and "Update" your page.Not all fields will be available for presentation in this manner, it depends on the fields/use/etc.
June 7, 2018 at 2:14 pm #220640canpress5MemberThank you for the explanation Terry!
In this scenario can you update multiple pages from your Client Settings page or just one page?
June 7, 2018 at 3:28 pm #220641TerryMemberGlad to be helpful.
You can try and see what works for your specific situation. The folks at ACF are probably the best resource if you have support questions. They also have great resources for delving a little deeper into ACF.
June 30, 2018 at 12:09 am #221229Brad DaltonParticipantACF provides the input. If you update the value for the key, the output will update anywhere you have coded it. That can be on single pages or archives.
June 30, 2018 at 11:13 am #221251canpress5MemberThank you for the input Brad.
I'm familiar with coding a template to output ACF values for a page or post that uses that template.
What I am uncertain about is how to output ACF values in multiple locations, eg in Terry's Client Settings page example above, you could have custom_field_a which needs to be output on Page A, and custom_field_b which needs to be output on Page B, and custom_field_c which needs to be output on both Archives C and D.
What would the code look like in each of those templates to display ACF values which are updated in one central location, considering the Client Settings page can only be associated with one template?June 30, 2018 at 8:27 pm #221262Brad DaltonParticipantPlease send me a json export of the Client Settings page and i'll test it.
June 30, 2018 at 10:42 pm #221267canpress5MemberPlease send me a json export of the Client Settings page and i'll test it.
I haven't created that page - it was a suggestion made by Terry earlier in this thread, but I don't know how it works.
Thanks for the offer though, I will take you up on it if I make any progress with this. -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.