Support

Account

Home Forums General Issues Does ACF work by directly editing template files?

Solving

Does ACF work by directly editing template files?

    • CCAZ

    • July 4, 2019 at 6:37 pm

    I’m not familiar with how ACF ( or any plugin ) applies itself. I’m asking because I’m having issues with ACF ( meta-blocks? ) that aren’t working since latest updates.

    Perhaps separate from that though – I’ve been having issues with getting changes to save properly. When I look at the php for the template page I want to edit, I see portions of the ACF code are in there – “hard coded”.

    I’m not sure if the previous developer added this code, or if the plugin itself adds the code on that page.

    Any insight appreciated.

    PS: I fixed the current issues I’m having by just hard coding the fields into the template – and when I opened the template to edit, I was surprised to see one of the fields I wanted to add commented out.

  • ACF does not alter theme code. The developer that built the site coded the templates. If you add fields than you need to add code to show those fields.

    • CCAZ

    • July 9, 2019 at 12:16 am

    This is how I understand the process:

    1) I create a field using the plugin, and assign it to all posts (?) of a certain type ( template, page, etc )

    2) On that specified page, I now see the field, and can add content.

    3) I hit publish and now people can see the page

    Are you saying that for this to be visible to public, I have to edit the template code?

  • Yes, that is what I’m saying.

    There may be other 3rd party plugins that alter this.

    There are ways to generically add some fields to the front end of the site that the developer may have used https://www.advancedcustomfields.com/resources/get_fields/.

    But as a general rule, ACF fields are only shown if the template is modified to show them or some other tool for altering templates is used.

    • CCAZ

    • July 9, 2019 at 8:04 am

    Hi John – I appreciate your patience – my language is not precise and I want to make sure I understand.

    In step-2 above, in wordpress wpadmin, I open a page called Our Professionals. This uses a template called Professionals. In step 1, using ACF, I added a new field to all pages created with the template Professionals.

    On the Our Professionals page can now see this new field Job Title and I type “Partners” into the field. Press Publish.

    When I press Publish, the wordpess saving mechanism kicks in, and somehow ACF piggybacks on this, so the field Job Title and it’s content Partners is included and saved.

    I do NOT need to manually edit any PHP templates ( as in writing out PHP code to call the field ) .

    Correct?

  • Not Correct. At least not normally.

    When you now view this page do you see your new value shown anywhere? If you do than there is already code to display the new field how it is being shown. If not then you will have to modify the template if you want to see this new information.

    • CCAZ

    • July 10, 2019 at 7:37 am

    ok

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.