Support » Themes and Templates » Problem with using paging for custom post type

  • Hello
    I have a problem showing my category page in pageing
    I have a custom post type named ‘videos’
    I put all the posts of this type in a one category names ‘cars video’
    I use a template page category-9.php’ as the id of this category ‘cars video’ is ‘9’

    I place this code at the top of my loop

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		<?php query_posts( $query_string . '&post_type=videos&posts_per_page=10&paged=' . $paged ); ?>
    		<?php if ( have_posts() ) : ?>
    			/* Start the Loop */
    			while ( have_posts() ) : the_post();

    I got the first page ‘’ working fine but I have this pages not working

    it gave me 404.php page

    Any advices?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thanks I solved it

    the problem was not in query or the paging but I used category-9.php template page
    but I fixed it by using archive-videos.php


    Glad that you make it resolved. My personal openion for paging is don’t use custom code rather then use wordpress number paging fuction tio replace previous /mnext links

    very few people knowing about this inbuilt function

    global $wp_query;
    $big = 999999999; // need an unlikely integer
    echo paginate_links( array(
    'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
    'format' => '?paged=%#%',
    'current' => max(2, get_query_var('paged') ),
    'total' => $wp_query->max_num_pages,
    'show_all' => false,
    'prev_next' => True,
    'prev_text' => __('« Previous'),
    'next_text' => __('Next »')
    ) );?>

    For replace ment technique you can find more details here –

    [ link moderated ]

    Above WordPress function works with custom post-type as well 🙂

    For more parameters and related arguments check


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with using paging for custom post type’ is closed to new replies.