• Resolved manuelxx

    (@manuelxx)


    Hello,

    I’ve got 3 loops on my site: Featured, Asides and News posts. I want to be able to navigate through them separetly, maybe using ajax plugins? How can this be done??

    I’m using query_posts(—-category stuff) for the Asides and News posts…

    thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • I’ve got 3 loops on my site: Featured, Asides and News posts. I want to be able to navigate through them separetly

    You will probably want to provide an example to better explain what you are looking to accomplish.

    Thread Starter manuelxx

    (@manuelxx)

    Here’s an image:

    Image!

    Two of the loops are shown (Featured Articles and News). As you can see, below each group of posts, there are two arrows, they allow me to cycle through the last 10-15 posts in each category. It would be best to do it without living the current page…

    I’m using query_posts() 2 times, exactly the same code except for category_name and showposts number:

    <?php query_posts('category_name=articulos&amp;showposts=4'); ?>
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                <!-- All the stuff I do to display the posts -->             
    
       <?php endwhile;?>
    <?php endif; ?>
    
    <?php query_posts('category_name=noticias&amp;showposts=3'); ?>
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                <!-- All the stuff I do to display the posts -->             
    
       <?php endwhile;?>
    <?php endif; ?>
    Thread Starter manuelxx

    (@manuelxx)

    are there plugins that manage multiple loops with ajax?

    It would be best to do it without living the current page…

    Not sure what you mean by this.

    What is happening now that you want to change?

    Please provide a link to see the problem.

    Thread Starter manuelxx

    (@manuelxx)

    My mistake… It’s a typo: I want to be able to navigate through one of my group of posts without lEAving the page. I mean, having the last 20 posts of each group loaded and being able to cycle through them using the arrows below each group (next and previous buttons).

    I don’t have a live version yet…

    But: what happens now is
    1- navigation makes me jump page…
    from https://www.server.com to https://www.server.com/page/2

    2- My navigation buttons only seem to recognize the first group of posts. When I jump to previous or next pages, only the first group goes back and forward, I’d like to move back and forward separetly within each group. Here’s a more complete version of the code above:

    <!-- First group of posts... this displays the number of posts I specify in my Reading Tab of the Options Panel -->
             <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
     <!-- Display some stuff using normal tags like the_author and the_content -->
    
    	<?php endwhile; ?>
    
      		  <div class="entry navigation fix">
      		    <br class="clear" />
    
            <ul class="home-nextprev fix">
      		<li class="next"><?php previous_posts_link('%link') ?></li>
     		 <li class="previous"><?php next_posts_link('%link') ?></li>
    	</ul>
    
        		</div>
      		  <?php else : ?>
      		  <!-- Don't have posts to display -->
      		<?php endif; ?>
    
    <!-- Second group of posts -->
    <?php query_posts('category_name=articulos&amp;showposts=4'); ?>
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                <!-- All the stuff I do to display the posts -->             
    
       <?php endwhile;?>
    <ul class="home-nextprev fix">
      		<li class="next"><?php previous_posts_link('%link') ?></li>
     		<li class="previous"><?php next_posts_link('%link') ?></li>
    </ul>
    <?php endif; ?>
    
    <!-- Third group of posts -->
    <?php query_posts('category_name=noticias&amp;showposts=3'); ?>
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                <!-- All the stuff I do to display the posts -->             
    
       <?php endwhile;?>
    <ul class="home-nextprev fix">
      		<li class="next"><?php previous_posts_link('%link') ?></li>
     		 <li class="previous"><?php next_posts_link('%link') ?></li>
    	</ul>
    <?php endif; ?>

    The ‘paged’ query var is used with the query_posts loop to handle the paging process and I don’t think that can be used with three different query_posts loops.

    Thread Starter manuelxx

    (@manuelxx)

    A similar effect is used here ond the featured section:
    https://demo.colorlabsproject.com/arthemia/

    I’m guessing they query all the posts they show on the sidebar “carousel”. So I can query my three different loops. It wouldn’t be a “standard paged” navigation, this solution wouldn’t use the previous_posts_link and next_posts_link

    I wonder if there is a plugin ready for this.

    Thread Starter manuelxx

    (@manuelxx)

    Well, I researched the way it works on the Arthemia Premium theme and other themes around there. It uses this great script: JCarousel
    https://sorgalla.com/jcarousel/

    As someone else pointed out in a related forum topic, getting it to work with wordpress requires to move all CSS and JS imports from the <head> to the <body>.

    With that in mind, I just copy pasted the code from the examples, changed the paths of my imports and wraped my posts on an
    “ul” as required by the script. More info about that: here.

    Thanks anyway…

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Separate paged navigation with Multiple Loops’ is closed to new replies.