If you have troubles since the update to WordPress 4.5 please read this post before opening a new thread.
I am using some plugins that add posts with custom post types and taxonomies. Is it possible for me to add some code in my functions.php that forces a specific template I have created with the template builder (example: ‘partners’) to any post within a category (example: ‘our-partners’)?
My issue is that after importing a very large number of posts I would prefer to just force the template vs edit each one.
This is a bit complicated. I will tag Kriesi and each support staff to help you out.
Personally I don’t think this is possible without some custom work/code which is beyond the scope of this support forum but I’ll tag it for Kriesi. Maybe he can provide something…
hm not sure if this would work but you can test the following:
first create a dynamic template. (lets call it “dyn_feedback”)
Then create a new php template file for one of the custom post types: for example if you got a post type feedback name the file single-feedback.php. WordPress will automatically use this file for your single entry feedback posts. Now if you paste the code from the template-dynamic file into the single-feedback.php file and change the line:
$template_name = avia_post_meta($post_id, 'dynamic_templates');
$template_name = 'dyn_feedback';
that might work. It is untested and just an idea but it might actually work so give it a try and let us know if it works :)
The topic ‘Set custom template for all posts in category’ is closed to new replies.