WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently developing a WordPress website with a custom post_type called "music". I use the plugin wp-pagenavi to paginate content "music".

When I link on the first page, it's OK (see link below) http://carbonpaper-dev.imperatorium.org/music/page/1

But when I link on the 2nd page: http://carbonpaper-dev.imperatorium.org/music/page/2 the expected content is printed, but the template displayed is not the one related to the "music" post_type/page as the first page do but the one related to classic "posts" (not the same sidebar, no inclusion of music playback on click. ..)

Here is my .htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule . /index.php [L]

# END WordPress

Should I change this file? otherwise how to fit the extension wp-pagenavi with a custom post_type? or what should be the name for the file {filename}.php in order to respect hierarchy template?

Thank you for your reply, and apologies for my English, I'm French...

share|improve this question

migrated from stackoverflow.com Jul 3 '11 at 8:25

This question came from our site for professional and enthusiast programmers.

ok, thanks for your reply. – beR- Jun 28 '11 at 9:55

Try this for the loop code.

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$loop = new WP_Query( array(
    'post_type' => 'music',
    'paged' => $paged
) ); 
share|improve this answer

or try this

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

                $args = array(
                    'post_type' => 'music',
                    'post_status' => 'publish',
                    'orderby'=> 'menu_order',   
                    'order'=> 'DESC',
                    'paged' => $paged,
                    'posts_per_page' => -1,
                    'caller_get_posts'=> 1

                $temp = $wp_query;  // assign original query to temp variable for later use
                $wp_query = null;
                $wp_query = new WP_Query();

                while ( $wp_query->have_posts() ) : $wp_query->the_post();?>
share|improve this answer
can you explain what you did and why this should work? – s_ha_dum Sep 30 '15 at 14:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.