• Hi,

    I have a vertical side bar menu placed on the left side of the page in my shopping section. Problem is that for some reason it displays older item to newer item so that every time I add new items they are placed at the bottom of the menu… Here is what I have:

    <div class=”shop-sidebarwidth”>
    <div class=”shop-category”>T-shirts</div>
    <div class=”shop-menuitem”><?php wp_cat_posts(36); ?></div>
    </div>

    Is there anyway that I can change that which display newer item on top? I thought that would be default for WordPress… Please help!!

    AD

Viewing 5 replies - 1 through 5 (of 5 total)
  • wp_cat_posts isn’t a WordPress function – so you’ll need to look in your theme to find where this function is defined first. Try looking in functions.php.

    Thread Starter Agent D

    (@agent-d)

    Oh, you are right. It was a plug-in (pasted below). What should I should I change?

    function wp_cat_posts( $catID = 0 ) {
    $catID = (int) $catID;
    $posts = get_posts(array(‘category’ => $catID, ‘numberposts’ => -1, ‘order’ => ASC, ‘orderby’ => title));

    foreach( (array) $posts as $post ) {
    echo ‘ID) . ‘”>’ . $post->post_title . ‘
    ‘;
    }
    }

    Thanks!

    Try changing:

    $posts = get_posts(array('category' => $catID, 'numberposts' => -1, 'order' => ASC, 'orderby' => title));

    to:

    $posts = get_posts(array('category' => $catID, 'numberposts' => -1, 'order' => DESC, 'orderby' => title));

    Thread Starter Agent D

    (@agent-d)

    Worked!! Thank you sooooo much!!

    You’re welcome. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Side bar problem – displaying from old to new instead of new to old’ is closed to new replies.