WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] one more time where does this php code go to force ascending post order (5 posts)

  1. fatman
    Member
    Posted 7 years ago #

    <?php query_posts('order=ASC'); ?>

    is this the right code and if so where does it go? Please help if you are out there.

  2. MichaelH
    Member
    Posted 7 years ago #

    Guess you want me to say your index.php file, just before The_Loop, that's assuming your index.php file is where you are intending that to happen.

    See:
    The_Loop_in_Action
    Stepping into Templates
    Template Hierarchy
    Template_Tags/query_posts

  3. fatman
    Member
    Posted 7 years ago #

    here is my index.php file in my blog directory

    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', true);
    require('./wp-blog-header.php');
    ?>

    do i just insert it somewhere here? i am confused by the Loop references. I am using the basic classic blue template and just want users to see my blog from the first day when they go to http://www.mydomain/blog

    can you tell me if I must insert the php statement somewhere else in a template? or different index.php file?

    also, is that a correct php command/query?

    BTW thanx for the response

    FatMan

  4. MichaelH
    Member
    Posted 7 years ago #

    No, look at wp-content/themes/yourthemename/index.php.

    Template Hierarchy explains the other template files in your theme folder.

  5. fatman
    Member
    Posted 7 years ago #

    no that didn't work. this is what needs to be added and where it needs to be added for anyone else's future reference. Since it was such a seemingly simple mod I assumed it would be easy to get to, but no.

    wordpress version 2.2.1 using blue basic theme included
    modification: to have posts appear in ascending order (from first blog entry)

    1) go to http://www.yourdomain.com/blog/wp-content/themes/default/index.php

    2) insert this line

    <?php query_posts($query_string."&order=ASC"); ?>

    3) right after the first php command

    <?php get_header(); ?>

    and

    4) before the "loop" statement

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    hope this helps save someone else at least a few hours searching this support forum.

    It sets the posts to the initial one but doesn't doesn't set the sidebar calendar there as well. If anyone knows how to do this please advise.
    FatMan

Topic Closed

This topic has been closed to new replies.

About this Topic