WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] List Posts Alphabetically by Category (3 posts)

  1. mujahideenryder
    Member
    Posted 6 years ago #

    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!

  2. Dgold
    Member
    Posted 6 years ago #

    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,

    <?php
    // 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!

  3. mujahideenryder
    Member
    Posted 6 years ago #

    Thank you very much!

Topic Closed

This topic has been closed to new replies.

About this Topic