• Hi there

    I am having an issue with custom post type page pagnation with permalink structure. Bascially a 404 error.

    I have created a custom post type ‘performance’ for my sessions page (realised i couldnt use session as post type due to conflict) and paignation works if i keep to the custom post type permalink structure so /performance/songname

    however, i do not want it to be called performance as this should be on the sessions page. So i changed the

    ‘rewrite’ => array(“slug” => “performance”),

    in custom post type so the url of these posts with displayed on the sessions page as /sessions/songname

    however, the pagnation of these pages will not work i get a 404 error when clicking page 2

    My code for my page display is below, anyone has any suggestions on how i could make the permalink pagnation work – i have been banging my head against the wall for the past 3 days…

    ‘<?php get_header(); ?>

    <!– Main Content –>
    <div id=”wide-content”>
    <div class=”wide-content-div”>

    <h1>Sessions</h1>

    <div class=”group”>

    <?php $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query(‘post_type=performance’ . ‘&paged=’ . $paged . ‘&posts_per_page=20’); ?>
    <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>

    <div class=”sessions”>
    <div class=”img”><h5>” title=”<?php the_title_attribute(); ?>” ><?php the_post_thumbnail(); ?><?php the_title(); ?></h5></div>

    </div>

    <?php endwhile; ?>

    <div class=”clear”></div>

    </div>

    </div>
    <div class=”page-navi-div”>
    <p><?php global $wp_query;

    $total_pages = $wp_query->max_num_pages;

    if ($total_pages > 1){

    $current_page = max(1, get_query_var(‘paged’));

    echo ‘<div class=”page_nav”>’;

    echo paginate_links(array(
    ‘base’ => get_pagenum_link(1) . ‘%_%’,
    ‘format’ => ‘page/%#%’,
    ‘current’ => $current_page,
    ‘total’ => $total_pages,
    ‘prev_text’ => ‘Prev’,
    ‘next_text’ => ‘Next’
    ));

    echo ‘</div>’;

    }

    ?></p>
    </div>
    <?php $wp_query = null; $wp_query = $temp; ?>

    </div>

    <?php get_footer(); ?>’

  • The topic ‘Permalink pagination error with custom post type page’ is closed to new replies.