Created
July 27, 2012 01:18
-
-
Save zanematthew/3185613 to your computer and use it in GitHub Desktop.
Arsh Redirect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'template_redirect', 'boo' ); | |
function boo(){ | |
// ge the global post type | |
global $post_type; | |
// this is the one we want to match against | |
$my_cpt = 'publications'; | |
// if they don't match just exit, may need to return; instead? | |
if ( $post_type != $my_cpt ) | |
exit; | |
// We separate/explode the url on / to get an array. | |
$url = explode( '/', $_SERVER['REQUEST_URI'] ); | |
// check if this is a multi-site install | |
$term_slug = $url[1]; | |
if ( is_multisite() ) { | |
if ( ! SUBDOMAIN_INSTALL ) { | |
$term_slug = $url[2]; | |
} | |
} | |
print_r( $term_slug ); // there's your term slug, use that in your template | |
// from here just call your template | |
load_template( 'publications-whever.php' ); // load your single, archive template or what ever | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment