- This topic has 4 replies, 2 voices, and was last updated 7 years, 5 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › Modify Template to Switch Cases
Hi,
I am trying to modify the results.php template so that I can display a different loop for my different custom post types. I was trying something along the lines but it doesn’t work. I think my syntax is wrong in the first place. If you have any pointers on the best way to achieve this please let me know.
<?php $curtype = get_post_type( $post->ID ); switch($curtype){
case “events”: return ‘events code’;
break;
case “venues”: return ‘venues code’;
break;
}
?>
many thanks,
Andrew
Hi Trevor, thanks for the prompt reply, however that’s not the issue. Please look at my stackexchange thread which explains what I am trying to achieve:
https://wordpress.stackexchange.com/questions/318675/template-loop-add-switch-case-php
Also another question, doesn’t your results.php need to have wp_reset_postdata(); for best practices?