Return current page type

You need your own helper function which will return you what you need. It could be like this one: function wpse8170_loop() { global $wp_query; $loop = ‘notfound’; if ( $wp_query->is_page ) { $loop = is_front_page() ? ‘front’ : ‘page’; } elseif ( $wp_query->is_home ) { $loop = ‘home’; } elseif ( $wp_query->is_single ) { $loop … Read more

Pagination with custom post type not working

The pagination works only, if the paged attribute in the the global $wp_query variable is set. You could store your query manually in this global or just use query_posts() instead of new WP_Query(). <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $the_query = query_posts( array( ‘post_type’=>’article’, ‘posts_per_page’=>2, ‘orderby’=>’date’, ‘paged’=>$paged ) ); // … ?> The … Read more

How to completely disable a taxonomy archive on the frontend?

s_ha_dum’s answer didn’t work for me, but this did: /** * Completely disable term archives for this taxonomy. * @param string $taxonomy WordPress taxnomy name */ function kill_taxonomy_archive($taxonomy){ add_action(‘pre_get_posts’, function($qry) { if (is_admin()) return; if (is_tax($taxonomy)){ $qry->set_404(); } } ); }