Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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]
RewriteCond %{REQUEST_FILENAME} !-F
RewriteCond %{REQUEST_FILENAME} !-D
RewriteRule . /index.php [L]
</IfModule>

# 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
add comment

2 Answers 2

Try this for the loop code.

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

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();
                $wp_query->query($args);            

                while ( $wp_query->have_posts() ) : $wp_query->the_post();?>
share|improve this answer
add comment

Your Answer

 
discard

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.