WordPress.org

Ready to get started?Download WordPress

Forums

Sort alphabetically by title not working for me (1 post)

  1. tsalagi_red
    Member
    Posted 8 years ago #

    I need to display my post titles alphabetically. I have used the code suggested in the codex and have read several articles on the subject, but it doesn't seem to be working for me. I have inserted at the top of my index.php page:

    <?php
    get_header();
    ?>
    <div id="tab_posts">
    <?php
    $posts = query_posts($query_string . '&orderby=title&order=asc&posts_per_page=-1');
    if (have_posts()) : while (have_posts()) : the_post(); ?>

    But my page still sorts by date.

    I have also tried this to no avail:

    <div id='tab_pages' class="menupage" style="display: none;">
    <h2><?php _e('Chapters:'); ?></h2>

    <ul><?php
    $posts = get_posts('orderby=title&order=asc');
    foreach($posts as $post) :
    ?>

    Please help!!!! I need to get this working. Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic