• In one template I want to show the post in the normal order (First the newews) and in the other template show in the opposite way (First the Oldest).
    My php skills are worse than my english so…
    Any help?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Stick <?php $order = “ASC”; ?> in your template. If that doesn’t work, reference the template (like an archive) like this: https://yoursite.com/template.php?order=ASC

    Thanks! It worked perfectly ??

    Note that if you have a RewriteRule in your .htaccess creating friendly permalinks, referencing the template in the URL you type into your browser won’t work. What you want to do instead is add “&order=ASC” to the rule in .htaccess, thusly (for a category archive):
    RewriteRule ^archives/category/?(.*) /index.php?category_name=$1&order=ASC [QSA]
    or thusly (for a month/year archive):
    RewriteRule ^archives/([0-9a-z-]+)?/?([0-9]+)?/?$ /index.php?name=$1&page=$2&order=ASC [QSA]
    Hope this helps someone.

    davidchait

    (@davidchait)

    And just since it’s been a problematic thing to implement, note that the $order=’ASC’ must come BEFORE the wp-blog-header include for it to actually work. ??
    -d

    Would <?php $order = “ASC”; ?> go in the templates.php file?

    It goes to the file index.php in the root directory (NOT theme directory) of WP installation


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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Order from the First to the Lastest Post’ is closed to new replies.