No rush on this, but I get asked a lot about when to use the Template Builder and when to create a custom content part or custom PHP template.
Here’s a case:
Design calls for a Custom Post Type = Attorneys
Single Post Template needs a title and image that displays across the top of the content/sidebar. The content consists of 2/3 column with the_content plus 1/3 column for a bunch of custom fields (no widgets).
The student replicated the Portfolios plugin and changed it to be Attorney. (She had several custom post types she was creating, and I thought making a version of the Portfolios plugin would be best as then she could take advantage of the JS integration already though through with the Portfolios plugin.)
She then built a custom Template in the Template Builder that did everything she needed it to do using the ACF (Advanced Custom Field) shortcode for the cf values in a Content Element. Then, on each Attorney post, she chose this Template. The hitch? Well, the html she was using before the custom fields for labels outputs regardless of whether there is a value for the cf. She needed these to conditionally show instead.
What I told here was this:
1 – I would set the Sidebar Layout to Full Width in Theme Options for this CPT.
2 – I would create a custom content-____.php part to handle the Title, large image, and columns for the content and conditional custom fields.
My general inclination is create a custom content part if working with true template needs with posts and custom post types and reserve the Template Builder for more unique layout needs for pages. I guess I’m still feeling like not overusing the Template Builder. I think it create more steps and possibly more queries. What are your thoughts and opinions? I know we can load our own Elements into the Builder or even create our own shortcodes to use with her ACFs, and that would be one way to deal with her custom field conditionals, but still seems like more work than creating a custom content part, imho. Not to mention that the client has to select the Template Builder template on every post they create.
That all being said, I’m wondering if you might do more with Custom Field Element in the future to add functionality to have “before” and “after” html that only output if the CF had a value? That would truly be awesome.
Anyway, please let me know if there’s something obvious I haven’t thought of or missed! I do want to give people some good guidelines, because most of my students are coming from zero template experience. I’m also trying to get people more familiar with the ACF plugin and Pro version for different template needs. I’m also a bit Zen in my approach (simpler is better) and conservative about using the Template Builder. That’s not to say I haven’t been going crazy gangbusters with the new Template Builder Elements myself!!!
- You must be logged in to reply to this topic.