Grow your CSS skills. Land your dream job.

WordPress Pagination & Custom post types

  • # June 11, 2012 at 8:03 am

    I’m having a problem getting this pagination working it always shows 404 error when I click next.

    & here is the pagination function

    function my_paginate_links() {
    global $wp_rewrite, $wp_query;
    $wp_query->query_vars > 1 ? $current = $wp_query->query_vars : $current = 1;
    $pagination = array(
    'base' => @add_query_arg('page','%#%'),
    'format' => '',
    'total' => $wp_query->max_num_pages,
    'current' => $current,
    'prev_text' => __('« Previous page'),
    'next_text' => __('Next page »'),
    'end_size' => 1,
    'mid_size' => 2,
    'show_all' => true,
    'type' => 'list'
    );
    if ( $wp_rewrite->using_permalinks() )
    $pagination = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );
    if ( !empty( $wp_query->query_vars ) )
    $pagination = array( 's' => get_query_var( 's' ) );
    echo paginate_links( $pagination );
    }

    So what’s wrong & how can I fix this?

    Thanks.

    # June 14, 2012 at 7:07 pm

    anyone :)?

    # June 15, 2012 at 5:04 am

    Any chance you can show how this ends up on the site? Where do the pagination links point to?

    # June 16, 2012 at 8:51 am

    The pagination link is /page/{page number} so when I click next page /page/2/ I get the 404 page.

    Unfortunately I can’t show the site.

    # June 16, 2012 at 11:28 pm

    Do any other permalinks work? Like http://www.yoursite.com/hello-world and such?

    # June 17, 2012 at 9:32 am

    Yeah the whole websites links works perfectly it’s just the pagination links

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".