Support » Fixing WordPress » Change Post Order in Categories

  • I’ve searched and read a number of messages here relating to post order, and have successfully been able to change to chronological order of my blog’s posts on a global basis by doing this to the index.php file:

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

    However, I would like to find out if this can be done for a SINGLE category — say it’s called “Max” What is the code I would need to accomplish this? And where would I place the code. I have attemted an “if” statement bfore the order line, but my skills in this area did not result in success. I’d appreciate any guidance — the more explicit the better.

    Thanks.

Viewing 1 replies (of 1 total)
  • If not using custom permalinks:

    if (isset($_GET['cat'])) {
    if('CATNUM' == $_GET['cat']) {
    $order = 'ASC';
    }
    }

    Change CATNUM to the numeric ID for the category. Something like this should work when using custom permalinks :

    if (preg_match("/max/", $_SERVER['REQUEST_URI'])) {
    $order = 'ASC';
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Change Post Order in Categories’ is closed to new replies.