I’m getting ready to update a site that has about 150 custom posts with a specific layout. All of the content for the posts are pulled from custom fields.
I would like to rebuild this layout when I update the theme. Is there a way to build a global page builder template to use on each post that would then be populated from the custom fields on each post? And then if I decided later to update that template, could I do that globally and have it affect all of those posts?
Or am I better off to just code the changes into a page template within the theme like it is now?
I just partially answered my own question… I am using the Dynamik Theme, so I created hook boxes for each of my code snippets and set them to “shortcut”.
Next, I created a global row that picked up the data from my custom fields (advanced custom fields). I inserted that global row on a new page that had different data in the custom fields and it worked great, showing the new content.
However, I don’t want to edit all 150+ pages just to insert a global row, so I thought I would create a page template and then use shortcode to insert it via hookbox.
This works, but it inserts the exact content from my saved template… not the custom data from that page. Is there a way to make this work with the page template or do I need to insert that global row on every page? And If I have to use global rows, can I insert those via shortcode or php in the hook box?
Can you share the URL of the site you’re working on along with temp admin access so we can check? Also, can you provide all the codes you’ve added as well as the shortcodes you’re referring to?
I had a look at your issue and did some testing. Unfortunately, I don’t think we can get it working that way with the shortcode.
The reason is that the shortcode is being rendered by WordPress in the context of the original template. WordPress sets up all of the data for that template when it’s queried, so that’s what is used when it’s rendered.
In contrast, global rows are rendered in the context of the current layout. That layout is queried and setup first before the global rows are ever queried, so the data for it takes precedence.
Sorry if that’s though to follow, it’s definitely a tough one to explain.
I’ll think on it a bit more and let you know if I come up with anything, but I don’t think we’re going to be able to find a solution. Global rows are probably going to be the way to go. Sorry about that.
Thanks, Justin. That’s what I thought was happening between the two methods. I think for my purposes right now, I can get by with using a global row since I only need one row on that custom post type and I can use Genesis hook boxes to add components above or below the row.
I’m also experimenting with stuff similar to Gretchen. I’m using a CPT and global rows with shortcodes in them render just fine. The WP-TYPES/WP-VIEWS shortcodes show the custom fields of the CPT. Using a [fl_builder_insert_layout] shortcode to display that global row unfortunately doesn’t give the desired result. The row is rendered, but the WP-VIEWS shortcode doesn’t give any output.
Global rows with the WP-VIEWS content templates would produce an awesome solution. Is there any way to get this working (it almost does!)?
Unfortunately not at the moment because of how WordPress’ global variables work. We will be looking at the ability to work with post meta and customize things like single.php and archive.php, so our work there might help with this. I’ll keep this in mind as we get deeper into that.
We’re working on it, but in terms of priority, it hasn’t made it to the top of the list yet. That will be one of our primary focuses once we get 1.8 out the door. It’s a big project though, so I don’t have an ETA yet. Stay tuned!
BUMP. I had been pondering for the last few days on how to use BB with a CPT and then it occurred to me to create a template, insert the wp-views shortcodes and then use toolkit-views to render the fl_builder_insert_layout. It didnt work so I turned to the forum and can see others have been there before me!.
I don’t know if you are familiar with https://wp-types.com/home/views-create-elegant-displays-for-your-content/.
i was just trying to figure out a way to make custom post type layout without digging into the php… seems the product you linked is similar to Themify’s Custom Post Type plugin… wonder if anyone has compared the 2 here? and do they both work with BB? I’d love to see similar functionality from BB… perhaps being able to build a layout in BB and generate the php layout file??