I need to apply a specific content template to the posts belonging to a specific category. How can I do it?
Hello,
I’m Mohammed: the Toolset support team leader. I’ll give my best to help you to achieve your needs through Toolset components.
You will need the following:
- A content template
- Views if conditional
- Another content template that will be included inside the Views if conditional
The details:
- Let's say you have a custom post type "questions"
- There is a taxonomy "Questions Taxonomy" attached to the questions custom post type
- You can create a content template for the questions custom post type (Let's name it "Questions template")
- Then you create another content template for the posts of the type questions that are attached to the taxonomy "Questions Taxonomy" ((Let's name it "Questions taxonomy template")
- In the "Questions template" content template you can display the post body as a content template. So, we will use the "Questions taxonomy template" content template to display the post this time inside a view conditional.
The following code will do the job:
[wpv-conditional if="( has_term('questions-taxonomy1', 'questions-taxonomy', null) eq '1' )"]
[wpv-post-body view_template="Questions taxonomy template"]
[/wpv-conditional]
Please check this ticket: https://toolset.com/forums/topic/check-on-a-content-template-for-category/
And this link: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
I'm waiting for your reply.
Thanks.