get post_type in template hook
-
hi
my problem about template hook and detect post typethis code don’t work!
add_filter('template', 'echo_post_type'); function echo_post_type($template){ if ( !is_admin() ) { global $wp_query; echo $wp_query->post->post_type; //or global $post; echo $post->post_type; exit(); } }
why?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘get post_type in template hook’ is closed to new replies.