Skip Navigation

[Resolved] Content template for posts in a category

This support ticket is created 7 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 10:00 - - - - -
- - - - - - -

Supporter timezone: Africa/Cairo (GMT+02:00)

This topic contains 1 reply, has 2 voices.

Last updated by Mohammed 7 years, 4 months ago.

Assisted by: Mohammed.

Author
Posts
#467218

I need to apply a specific content template to the posts belonging to a specific category. How can I do it?

#467382

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.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.