How to use a different single.php if a meta_query exists?
-
I have a custom post type (speakers) and I have two type of speakers, conference speakers and workshop speakers. The types are set up as a checkbox custom field (using ACF). I have separate page templates for filtering my speakers. So, one page is showing the conference speakers and the other one is showing only the workshop speakers.
By default, all my speakers detail information show in my single-speaker.php page, but how can I use a different single page than the default one if the speaker is checked as workshop speaker? Maybe something like single-workshop-speaker.php.
This is the arg array I am using to specify the workshop speakers in my page template:
$args = array( 'post_type' => 'speakers', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'meta_query' => array( array ( 'key' => 'is_conference_speaker_or_workshop_speaker', 'value' => 'Workshop', 'compare' => 'LIKE' ) ) );
Thanks
- The topic ‘How to use a different single.php if a meta_query exists?’ is closed to new replies.