WordPress.org

Ready to get started?Download WordPress

Forums

Sort by title working fine - problem with Next / Prev on single.php page (1 post)

  1. Zaphod
    Member
    Posted 8 years ago #

    I've managed to get my wordpress site running and my posts sorting by title (ascending) rather than post id (descending). However, when I go into a specific post, the next / prev links are still sorting by post id (i.e. the previous post link links to the displayed item's previous and next post by post id RATHER THAN previous and next by title).

    Anyone know a good way to fix this? - obviously it's only affecting the single.php page..

    Firstly, here's how I achieved the posts listing alphabetically by title: (I know this info is elsewhere on the support but it took me some time to find it so it might be useful to others...)

    I replaced the line:

    <?php if (have_posts()) : ?>

    with

    <?php if (have_posts()) : $posts = query_posts($query_string . '&orderby=title&order=asc');
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags