Forums › Forums › Search & Filter Pro › Modify Template to Switch Cases
- This topic has 4 replies, 2 voices, and was last updated 8 years ago by
Anonymous.
-
Anonymous(Private) November 7, 2018 at 8:48 pm #193077
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,
AndrewAnonymous(Private) November 8, 2018 at 10:12 am #193108Hi 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?
-
AuthorPosts