Skip to content

Instantly share code, notes, and snippets.

@Roach
Created December 13, 2010 19:00
Show Gist options
  • Save Roach/739417 to your computer and use it in GitHub Desktop.
Save Roach/739417 to your computer and use it in GitHub Desktop.
// Redirect template based on post list or single post
function template_redirect()
{
global $wp;
if ($wp->query_vars["post_type"] == "dt_staff" || $wp->query_vars["taxonomy"] == "departments")
{
if ( is_robots() ) :
do_action('do_robots');
return;
elseif($wp->query_vars["name"]):
include(WP_PLUGIN_DIR.'/'.basename(dirname(__FILE__)).'/dt-staff-single.php');
echo ('single post');
die();
else:
include(WP_PLUGIN_DIR.'/'.basename(dirname(__FILE__)).'/dt-staff-list.php');
echo ('list page');
die();
endif;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment