Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In my home page i have two <section> in which i perform two different loops on different post categories. Here the code:

<section>
        <ul class="loop-article">
            <?php
                $pagedArticles = ( get_query_var('page') ? get_query_var('page') : 1 );
                $articles = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 3, 'cat' => 3,'paged' => $pagedArticles );
                query_posts($articles); $i=0; while (have_posts()) : the_post(); $i++;
            ?>  
<!-- do stuff  -->
            <?php endwhile; global $wp_query;
            $big = 999999999; // need an unlikely integer
            echo paginate_links( array('base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),'format' => '?paged=%#%','current' => max( 1, get_query_var('paged') ),'total' => $wp_query->max_num_pages) ); 
            wp_reset_query(); ?>            
        </ul>
</section>
<section>
            <ul class="loop-news">
            <?php
                $pagedNews = ( get_query_var('page') ? get_query_var('page') : 1 );
                $news = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 4, 'cat' => 4, 'paged' => $pagedNews );
                query_posts($news); $i=0; while (have_posts()) : the_post(); $i++;
            ?>                  
    <!-- do stuff  -->
            <?php endwhile; global $wp_query;
            $big = 999999999; // need an unlikely integer
            echo paginate_links( array('base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),'format' => '?paged=%#%','current' => max( 1, get_query_var('paged') ),'total' => $wp_query->max_num_pages) ); 
            wp_reset_query(); ?>
        </ul>
</section>

The problem i face is that if i try to see older posts of '.loop-article', pagination works on '.loop-news' too.

I think it depends on the same url that paginator creates for both loops:

www.mysite.com/page/2/

But i am not sure of this...is it possible to fix this?

share|improve this question
add comment

1 Answer

It can be done by AJAX, Read this tutorial which with a little modification can do what you want.

share|improve this answer
    
Thanks...is not a bad idea...but i am wondering if that is just a work around.. –  Salvatore Dibenedetto May 21 '13 at 15:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.