Create a specific wordpress template for an article
This support request was posted in Flatbase by powdesign
- powdesign January 25, 2017 at 5:16 pm
I have the flatbase theme and have a lot of articles. These articles have categories assigned to them.
I just cant figure out how to create a seperate wordpress template file that can be customised depending on which category that article belongs to.Your help would be much appreciated.
Juanfra Aldasoro January 25, 2017 at 5:40 pmHi,
Thank you for writing. I hope you are doing well.
Unfortunately this type of question would be considered as customization (actually extending the theme functionality via WordPress) and we cannot provide support for customizations. We wrote an article explaining this and you can find it here: https://nicethemes.com/article/support-vs-customizations-2/
That being said, I wanted to mention that articles use a custom post type named article and the article categories a taxonomy named article-category.
WordPress let you create custom templates for custom post types and custom taxonomies. You can read more about it here:
– Custom Post Type Templates
– Custom Taxonomy TemplatesBest,
Juan.powdesign January 25, 2017 at 5:48 pmHi Juan,
Thanks for your reply, I totally understand. Its just that I can’t seem to find the answer anywhere. I just need a bit of code to add to the functions file and then need to potentially create
single-article-categoryid.php but I cannot seem to get it to work. I think because the category is within the article part instead of the post maybe?Juanfra Aldasoro January 25, 2017 at 6:05 pmHi,
Thank you for the follow up.
I see. I think that the best answer you can find is in the WordPress documentation as this is a WordPress template hierarchy issue. You can find the complete article here: https://developer.wordpress.org/themes/basics/template-hierarchy/
Best,
Juan.
This topic is marked as resolved
Only the topic author can re-open this thread.