WordPress.org

Forums

Sorting posts on category page - I need a little extra code (5 posts)

  1. richarduk
    Inactive
    Posted 9 years ago #

    This is my basic loop for a category page where I'm inserting links to each post with an excerpt acting as a description.

    What do I need to do to sort the posts alphabetically?

    <?php foreach ($posts as $post) : start_wp(); ?>
    <div class="post">

    <h2 class="post-title">"> <?php the_title(); ?> </h2>

    <div class="post-content">
    <?php the_excerpt(); ?>
    </div>
    </div>

    <?php endforeach; ?>

  2. richarduk
    Inactive
    Posted 9 years ago #

    Damn!

    Forgot about the link going active.

    Try this.

    <?php foreach ($posts as $post) : start_wp(); ?>
    <div class="post">

    <h2 class="post-title"><z href="<?php the_permalink() ?>"> <?php the_title(); ?> </h2>

    <div class="post-content">
    <?php the_excerpt(); ?>
    </div>
    </div>

    <?php endforeach; ?>

  3. richarduk
    Inactive
    Posted 9 years ago #

    Anyone?

  4. moshu
    Member
    Posted 9 years ago #

    1. When posting code, please read the instructions below the input area.
    2. That seems to be a WP 1.2 Loop.
    3. Search results for "sort posts alphabetically":
    http://wordpress.org/search/sort+posts+alphabetically?forums=1

  5. richarduk
    Inactive
    Posted 9 years ago #

    Sorry! :-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags