WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How To - Newer Posts Instead of Older Posts? (13 posts)

  1. NesianStyle
    Member
    Posted 4 years ago #

    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

  2. vtxyzzy
    Member
    Posted 4 years ago #

  3. NesianStyle
    Member
    Posted 4 years ago #

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

    Any more help please?

  4. vtxyzzy
    Member
    Posted 4 years ago #

    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.

  5. Nile Flores
    Member
    Posted 4 years ago #

    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.

  6. NesianStyle
    Member
    Posted 4 years ago #

    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.

  7. vtxyzzy
    Member
    Posted 4 years ago #

    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()) : ?>
  8. NesianStyle
    Member
    Posted 4 years ago #

    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

  9. Nile Flores
    Member
    Posted 4 years ago #

    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.

  10. vtxyzzy
    Member
    Posted 4 years ago #

    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()) : ?>
  11. NesianStyle
    Member
    Posted 4 years ago #

    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!!

  12. vtxyzzy
    Member
    Posted 4 years ago #

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

  13. MrSerginho
    Member
    Posted 4 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.