WordPress.org

Ready to get started?Download WordPress

Forums

subcategory posts pagination (6 posts)

  1. eft0
    Member
    Posted 2 years ago #

    I have a category and subcategories for this WordPress.

    When I try to use pagination in the main category works perfect:

    http://domain.com/category/dvd/page/2/

    But in the subcategory its return 404 error and of course don't work:

    http://domain.com/category/dvd/fiction/page/2/

    I'm using the $paged variable in the query_posts() function of course.

    Any idea or tip'll be appreciate.

    Thanks!

  2. Jonathan Dingman
    Member
    Posted 2 years ago #

    Hmm why are you using $paged to create the second page? it should just work with the default theme files and code.

    Can you share the code you're trying to use to get it working?

  3. eft0
    Member
    Posted 2 years ago #

    Here is the code:

    <?php
    $current_category = single_cat_title("", false);
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("category_name=". $current_category ."&posts_per_page=3&paged=". $paged);
    ?>
    <?php $i = 1; if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="contenidos730">
    	<?php if ($i==1): ?><h3><?php echo $current_category ?></h3><?php endif; ?>
    	<div class="caja730">
    		<h1><?php the_title(); ?></h1>
    		<?php the_content(); ?>
    
    	</div>
    	<div class="shad730"><img src="<?php bloginfo('template_directory') ?>/img/caja730_shadow.png"></div>
    </div>
    <?php $i++; endwhile; endif; ?>
    
    <?php wp_paginate(); ?>
  4. novakpeter
    Member
    Posted 2 years ago #

    I have the same problem!!! It is probably a WP bug?

    My code is simple:

    $page = (get_query_var('paged')) ? get_query_var('paged') : 1; 
    
           if (is_category('blah1') OR is_category('blah2')){
            query_posts(array('post_type'=>array('post','ai1ec_event'),'paged' => $page));
           }
    
           if(have_posts()) etc....
  5. eft0
    Member
    Posted 2 years ago #

    novakpeter: I solve it creating a subpage with the subcategory name, and putting the code on it :(

  6. novakpeter
    Member
    Posted 2 years ago #

    Man...that is a good idea, I will try it. It s not elegant solution right, but maybe it will work:-) Anyway, I filled a bug report here:

    http://core.trac.wordpress.org/ticket/19985

    So, we will see...

Topic Closed

This topic has been closed to new replies.

About this Topic