How do I determine the layout style for posts in a specific category? Is it possible to do this?
How do I determine the layout style for posts in a specific category? Is it possible to do this?
Yes, just follow the Hierarchy of Templates . In your case, what you need is one of these two files in your theme:
/wp-content/themes/seu-tema/category-$slug.php
/wp-content/themes/seu-tema/category-$id.php
For example, if the category is "shoes," create the following file in your theme: /seu-tema/category-sapatos.php
.
Check slug
of your categories in http://example.com/wp-admin/edit-tags.php?taxonomy=category
, and ID by clicking on one of the categories in administration and checking tag_ID
on the URL.
In this visual guide you can see how the hierarchy works, the priority is from left to right. First look for the file category-$slug.php
, if there is no search for category-$id.php
, if it does not exist category.php
, etc.