Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #13094

    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.

    Thanks!

    #77759

    Hello,

    This is a bit complicated. I will tag Kriesi and each support staff to help you out.

    Regards,

    Ismael

    #77760

    Any update on this?

    #77761

    Hi!

    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…

    Regards,

    Peter

    #77762

    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');

    to


    $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 :)

    #77763

    This worked great! Thank you so much for the solution!

    #77764

    Terrific! Let us know if you have any more questions.

    Regards,

    Mya

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

The topic ‘Set custom template for all posts in category’ is closed to new replies.