WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 'paged=' parameter not working (5 posts)

  1. nutsmuggler
    Member
    Posted 7 years ago #

    The 'paged=' parameter does not work, neither in the previous/nex links, nor whe directly typed in the url field of the browser.
    This is my code; this snippet is embedded into a 'version' of home.php that displays only if (empty($_REQUEST['isarticles'])). In other words, I load this home to exclude posts from category 6.


    query_posts("cat=-6");
    if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>" class="post">
    <h2 class="post-title"><a>" title="Permalink to <?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    <div class="post-entry">
    <?php the_excerpt('<span class="more-link">Continue Reading �</span>'); ?>
    <?php //link_pages('<p class="paged-link">Pages: ', '', 'number'); ?>
    </div><!-- END POST-ENTRY -->
    <!-- <?php trackback_rdf(); ?> -->
    </div><!-- END POST -->
    <?php endwhile; ?>
    prenav
    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('� Earlier Posts') ?></div>
    <div class="alignright"><?php previous_posts_link('Later Posts �') ?></div>
    </div>
    postnav
    <?php else : ?>
    <div id="post-error" class="post">
    <h2 class="post-title"><span class="pre-title">404</span> Page Not Found</h2>
    <div class="post-entry">
    There's been a problem finding the page you're looking for. Apologies. Perhaps . . .
    <ul>
    <li>the page your looking for was moved;</li>
    <li>your referring site gave you an incorrect address; or</li>
    <li>something went terribly wrong.</li>
    </ul>
    Use the search box and see if you can't find what you're looking for.
    </div><!-- END POST-ENTRY -->
    </div><!-- END POST -->
    <?php endif; ?>

    Is there anything in my code that prevents the 'paged' parameters from working? Or is it a wp bug?
    Thanks in advance,
    Davide

  2. moshu
    Member
    Posted 7 years ago #

    I wouldn't call it a bug... however I have never seen the next/prev to work with a modified Loop.
    I mean just adding a "query_posts" diasables the prev/next - at least that was my impression seeing n+1 posts like yours.

  3. nutsmuggler
    Member
    Posted 7 years ago #

    Ah ah, I see the point.
    Is there a workaround or should use my own parameters? What would you suggest?
    Cheers,
    Davide

  4. nutsmuggler
    Member
    Posted 7 years ago #

    I found the answer here:
    http://wordpress.org/support/topic/38210
    Kafkaesquy suggest modifying the query

    query_posts("cat=-6");

    into

    $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=3&showposts=2&paged=$page");

    I understand the problem was that the 'paged' value had to explicitly requested.
    BINGO :-)
    Cheers,
    Davide

  5. mendezki
    Member
    Posted 7 years ago #

    Perfect! Exactly what I was looking for, thanks Kafkaesqui & Nutsmuggler, BINGO :-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags