Skip Navigation

[Resolved] Conditional layout checking wich Post Type the element is

This support ticket is created 7 years, 1 month 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 7 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#574878

Hi,

in my website, I have two Custom post Types, named Opleidingen and Opleidingsessies. Both CPT's have the same custom fields and are used in one view.
In that View, I want to have a conditional layout for both CPT's. So I want to seperate a little part of the code, one part for the CPT Opleidingen, one part for the CPT Opleidingsessies.

For example, the view contains a table. In a row where the CPT Opleidingen is listed, I want to place five cells. in a row where the CPT Opleidingsessies is listed, I want to place four cells. Is there a way to check wich CPT it is in the loop? Maybe with [wpv-post-type] = "opleidingen" ?

Thanks in advance,
Kind regards,
Jef M.

#574937

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Yes - you can use [wpv-post-type] with [wpv-conditonal] shortcode to check the current post type and build one content template for each post type, one with file cells and one with four cells and display it according to your post type.

I do not know whey you are going for this option, as its easy to build two views with separate post type assigned.

More info:
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/