Created
February 22, 2014 10:57
-
-
Save onishiweb/9152009 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* Work out the current post type | |
* - based on WP function or current taxonomy | |
* @author Adam Onishi ([email protected]) | |
*/ | |
function dig_current_post_type() { | |
global $post; | |
if( ! is_tag() ) { | |
$type_name = get_post_type(); | |
if( ! $type_name ) { | |
$taxonomy = get_query_var( 'taxonomy' ); | |
$type_name = substr_replace($taxonomy, '', -9); | |
} | |
return $type_name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment