WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] List cat/tag posts alphabetically by slug (5 posts)

  1. TCSG
    Member
    Posted 2 years ago #

    I'm creating a site that lists resources that are referenced in a book. These resources are categorized by book chapter (category), theme (tag), timeline (tag), and also have page numbers (custom meta-box info).

    I need the posts to be displayed according to their page number whether we're looking at them by category or tag. I could MANUALLY order them by date -- but there's A LOT of posts.

    I've tried looking into get_template_part() and get_post() and can't find ways to override that in functions.php to list alphabetically.

    Any help would be appreciated!

  2. TCSG
    Member
    Posted 2 years ago #

    Forgot to mention that the categories and tags are being listed in a widget automatically using Ultimate Tag Cloud Widget.

  3. Pioneer Valley Web Design
    Member
    Posted 2 years ago #

    You second part adds to this, also not sure which you want now, by page #, by slug, or by title??? Take a look at http://codex.wordpress.org/Alphabetizing_Posts

  4. TCSG
    Member
    Posted 2 years ago #

    Thank you! That got me about 80% there. For the Categories I added the code that page recommended for their "Glossary" example, inserting their code into category.php, but I deleted the reference to Glossary, like so:

    <?php
    // we add this, to show all posts in our
    // Glossary sorted alphabetically
    if (is_category(''))
    {
         $posts = query_posts($query_string .
    '&orderby=title&order=asc&posts_per_page=-1');
    }
    // here comes The Loop!
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    Next, I needed this to work for my Tags, so I inserted the same code into tag.php, but changed the first line to if (is_tag(''))

    Works great! Thank you!

  5. TCSG
    Member
    Posted 2 years ago #

    Resolved!

Topic Closed

This topic has been closed to new replies.

About this Topic