Support » Themes and Templates » List Posts Alphabetically by Category

  • Resolved mujahideenryder


    Hello everyone,

    On my blog, I want to have a feature that when you click on a category it lists all the posts under that category alphabetically.

    I can’t find any plugin or any topic that is similar to my situation.

    Any suggestions? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • It’s built into wordpress out of the box, you just need to modify the query. Read the codex if you need to learn more about modifying the query.

    Basically you put something like the code below, in your theme’s template files, in your case I think you want to put this in category.php

    Put this,

    // we add this, to show all posts in our
    // Glossary sorted alphabetically
    $posts = query_posts($query_string .
    '&orderby=title&order=asc&posts_per_page=-1'); ?>

    …Right before where The Loop starts with this,
    <?php while (have_posts()) : the_post(); ?>

    Hope this helps ya!

    Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘List Posts Alphabetically by Category’ is closed to new replies.