WordPress.org

Ready to get started?Download WordPress

Forums

Triton Lite
pagination in secondary loop (13 posts)

  1. miguelesquirol
    Member
    Posted 2 years ago #

    I'm trying to use the loop that is located in layout.php in another page (inside single.php), and I managed to make it work fine, but the pagination is not working, when I click on 2 it shows me the same page again. any idea how to fix it?

    http://wordpress.org/extend/themes/triton-lite/

  2. esmi
    Forum Moderator
    Posted 2 years ago #

  3. miguelesquirol
    Member
    Posted 2 years ago #

    I tried that and is not working... any other idea?

  4. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    have you checked how to use the 'paged' parameter, for instance?

    without seeing what you have coded, there is not much else to suggest than to read the codex.

    for more suggestions, please paste the full code of the template into a http://pastebin.com/ and post the link to it here.

    also, a link to your site might help to illustrate your problem.

  5. miguelesquirol
    Member
    Posted 2 years ago #

    Thanks for answering, I've been fighting the code over a week...

    The tempalte has a loop page called layout.php that is called from the index page, As you can see here the pagination works fine

    I'm trying to have the same code called from the single posts pages like this but the pagination doesn't work.

    The code I'm using in the single posts are:

    Here is the code

    [Code moderated as per the Forum Rules. Please use the pastebin]

  6. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    make sure to use straight quotes (') in your code - possibly through copy/paste you have these kind of quotes (‘ ’) which will not work.

    try:
    http://pastebin.com/RV4PkjnV

  7. miguelesquirol
    Member
    Posted 2 years ago #

    No the quotes are ok... but still doesn't work..

    I also tried different pagination plugins and the error persists.

    It won't access the "page 2" like this

    http://www.rotatingplanet.com/rotatin/2011/01/05/the-uluit/page/2/

  8. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    the last link is of a single post - and I couldn't find a pagination link on that web page.

    is that one of your problems?

    I'm trying to use the loop that is located in layout.php in another page (inside single.php),

    can you paste the full code of single.php into a http://pastebin.com/ and post the link to it here?

  9. miguelesquirol
    Member
    Posted 2 years ago #

    I was trying different things... now the pagination is there, and this is the link of the code

    http://pastebin.com/a6i44nc9

    thanks for your help

  10. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    this section is a bit odd - you are not actually putting anything out:

    query_posts( array( 'cat' => 61, 'paged' => get_query_var('paged') ) );
    
    while ( have_posts() ) : the_post();
    
    endwhile;

    are these codes supposed to be in the loop?

    <?php if( empty($option['trt_lay'])) { ?>
    <?php get_template_part('layout1');?>
    <?php }?>
    <?php if($option['trt_lay']== "Layout 1") { ?>
    <?php get_template_part('layout1');?>
    <?php }?>

    what is the code of layout1.php?

  11. miguelesquirol
    Member
    Posted 2 years ago #

    The layout is he loop that is called in the index.php it was originally in the theme

    Here it is the code

    http://pastebin.com/NpjjNX83

  12. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    that could be the problem - the layout1.php has the full loop, and you are running also a loop with your custom query;

    try to change this section:

    <?php
    
    query_posts( array( 'cat' => 61, 'paged' => get_query_var('paged') ) );
    
    while ( have_posts() ) : the_post();
    
    endwhile;
    
    ?>

    to:

    <?php
    
    query_posts( array( 'cat' => 61, 'paged' => get_query_var('paged') ) );
    global $wp_query; //possibly needed?//
    ?>

    you might also need to make $wp_query global;
    also add this in line 1 of layout1.php:
    <?php global $wp_query; ?>

  13. miguelesquirol
    Member
    Posted 2 years ago #

    MMM, no, nothing change... still the pagination won't work.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic