Support » Fixing WordPress » How To – Newer Posts Instead of Older Posts?

  • Resolved NesianStyle

    (@nesianstyle)


    I have my wordpress set up so that the first two or three posts stay the same on the front page. I have added a piece of code so it displays oldest to newest posts this way.

    The problem is that once I go past two or three posts the older entries link comes up (as in the image below) but if I click on it it will basically show the front page again and basically makes a loop.

    Does anybody know how I would get it to display newest posts instead?

    http://i49.tinypic.com/30bgu15.jpg

Viewing 12 replies - 1 through 12 (of 12 total)
  • Search for ‘paged’ in the Codex documentation for query_posts.

    Thanks, have found ‘paged’ but it’s kind of like trying to read another language, I have no clue!

    Any more help please?

    Without being able to see your code, I can’t be more specific. A link to your site would help, and the piece of code that you have added.

    Nile Flores

    (@blondishnet)

    Yoast Support

    Seems like your custom query was an older version.

    Check out the following thread first that I ended up solving. This was in particular to just showing a particular category.

    http://wordpress.org/support/topic/395421?replies=5

    However, you should probably just use the default WordPress loop. Some older Custom WP_Query no longer work correctly.

    If that is not… use the Pastebin.com , paste your pages code in there and share the link here so I can see the code.

    Thanks for your replies

    Here is the code that I have added (in bold) to the index.php file.

    <?php endif; ?>
    <?php query_posts(‘order=asc’); ?>
    <?php if (have_posts()) : ?>

    I am actually doing this to all my wordpress sites as it was the only way I could get the blog to display as I wanted it to.

    This should work to add pagination:

    <?php endif; ?>
    <?php $paged = (intval(get_query_var('paged'))) ? intval(get_query_var('paged')) : 1;
    query_posts("order=asc&paged=$paged); ?>
    <?php if (have_posts()) : ?>

    Unfortunately that threw up this error when added:

    Parse error: syntax error, unexpected T_STRING in /home/antique/public_html/wp-content/themes/Antique/index.php on line 38

    Nile Flores

    (@blondishnet)

    Yoast Support

    Can you pastebin the full code of that page… might help to get a full look.

    Your other query from your reply is missing a vital part of the if have posts.

    Sorry, missing a double quote in the query_posts:

    <?php endif; ?>
    <?php $paged = (intval(get_query_var('paged'))) ? intval(get_query_var('paged')) : 1;
    query_posts("order=asc&paged=$paged"); ?>
    <?php if (have_posts()) : ?>

    vtxyzzy….I think that has worked!

    When I click on the older link now it does show my most recent post on the page which was what I was after. Not sure what is going to happen after I add more posts though…guess I’ll find out when I add more content.

    Would be happy to pay for a can of coke if you have a paypal address I can send it to?

    Thanks to everyone else that tried to help also, it was much appreciated!!

    Thanks for the offer, but just donate to your favorite charity. Now, please use the dropdown at top right to mark this topic ‘Resolved’.

    vtxyzzy, can you help me to? I have a problem with my blog emisto.net
    The pages from pagenavi, if you click page 2 il be like fisrt page (home page).

    Please help me. Thnaks

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How To – Newer Posts Instead of Older Posts?’ is closed to new replies.