Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS paginate get_categories ?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #40226
    cybershot
    Participant

    I can’t figure out how to paginate my categories.php. I have this special loop. I have to have it done this way. I am returning three posts and need to get the pagination working to display the rest of the posts

    Here is the full loop
    $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1;
    //get the child categories and only display 3 posts
    $allcats = get_categories(array(‘child_of’ => get_query_var(‘cat’), ‘number’ => 3,’order’=> ‘asc’, ‘paged’ => $paged));
    foreach ($allcats as $cat) :
    $args = array(
    ‘category__in’ => array($cat->term_id),
    );

    $customInCatQuery = new WP_Query($args);

    if ($customInCatQuery->have_posts()) :
    echo ‘

    ‘;

    ?>

    echo ‘No post published in:’.$cat->name;
    endif;
    wp_reset_query();
    endforeach;

    #111568
    rachelbaker
    Member

    You need to use [get_query_var()](http://codex.wordpress.org/Function_Reference/get_query_var “get_query_var”)

    #111570
    rachelbaker
    Member

    Example:

    $customInCatQuery = new WP_Query($args, ‘paged=’ . get_query_var( ‘paged’ ) );

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.