Altering get_template_part
-
Hi there.
In my single.php file, I have this code to call the contents of a post.
<?php get_template_part( 'includes/loop' , 'single'); ?>
Can I alter it to show different contents/templates based on the given tags of posts?
Say, I want to get the template loop-cat (includes/loop-cat.php) if post tag is ‘cat’. Same goes for the other template. Most propably I will have at least 10 templates to show.
I dont want to merge them in a sinlge loop file because I am worried that the file may get heavy.
Please help me. If there are other better ways to call different templates for different tags, please let me know.
Thanks a lot.
- The topic ‘Altering get_template_part’ is closed to new replies.