Home Forums Front-end Issues Adding fields to template for dummies


Adding fields to template for dummies

  • Can someone please break this down elementary style for me? The documentation is great, but obviously geared to WordPress developers who don’t need a step by step in where the heck to insert this code.

    I a using the Divi template. I am trying to build a “Projects” template, where each post will display a field group (size group, size, materials, cost). i want the first three to show on the front end, with their labels, right under the WordPress title of the post.

    Where in the theme do I put this? I am guessing I edit the Single Post file? And then… where? I am not a developer and have little desire to be one, but I can manage to read and work out most php, etc. I just need some more beginner help on how to get this started.

  • Divi is a complex theme that has its own rules and most WP documentation will not really tell you all the details that you’ll need to know on the “Where” question. The only thing that the ACF documentation will help you with is the “What”. The best source information for “Where” is going to be the Divi documentation and Divi support.

    In a normal theme:
    If you are adding custom fields to “Posts” the you would put code into single.php or a template part that is loaded by single.php. Where you actually need to put it, like I said, is dependent on the theme. The code needs to be inside the “The Loop” and you’ll need to figure out where that is.

    If you want the fields to appear on an archive page for “Posts” then you need to start looking at the right archive template.

    If you are adding fields to “Pages” then you would put the code into the template or associated file for that page. Again, it needs to go in “The Loop”

    Like I said, every theme is different, every theme author builds themes a little differently, and Divi is going to be more complicated. The ACF documentation cannot take all this into account and is the reason that the exact “Where” to put things isn’t found anywhere, that’s something that each developer needs to work out.

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

The topic ‘Adding fields to template for dummies’ is closed to new replies.