2 replies
I just downloaded a simple wordpress theme for my blog (In my sig), under the categories section it is going from old to new, so my first ever post will always be at the top and at the bottom will be my new posts. What piece of code would I have to use to change that so my new post go at the top and old ones get pushed down the page. This is the code from my sidebar.php file. (No functions in the theme do this from what I can see.)

PHP Code:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar1') ) : ?>

<li>
<h2>Categories</h2>
<ul>
  <?php wp_list_categories('show_count=0&title_li='); ?>
</ul>
</li>
Thanks.
#php
  • Profile picture of the author mywebwork
    Hi Lee

    If I understand you correctly you want the Categories to list in the opposite order?

    This change should do the trick:

    Code:
    <?php wp_list_categories('show_count=0&order=DESC&title_li='); ?>
    If that's not quite what you want this page from WordPress should explain some other options for you:

    Template Tags/wp list categories WordPress Codex

    Hope this helps.

    Bill
    {{ DiscussionBoard.errors[1640775].message }}
  • Profile picture of the author chaos69
    You are posting the post title as the post as the post category - is that how you meant to do it?

    Anyway, you can change the order of the category listings by using ASC and DESC in the parameters..... EG wp_list_categories('order=DESC');

    You can get plugins that will do this for you that you just drag over to the sidebar and configure them in a few clicks.

    Full specs on that function are here:
    Template Tags/wp list categories WordPress Codex
    Signature
    Best Ways To Make Money Online

    Eight bytes walk into a bar. The bartender asks, “Can I get you anything?”
    “Yeah,” reply the bytes. “Make us a double.”
    {{ DiscussionBoard.errors[1640779].message }}

Trending Topics