• Resolved grishart

    (@grishart)


    Hi All

    I want to show the search results alphabetically on my archive.php page as I have it set on my index page.

    I used the following code on my index page.

    <?php
    // we add this, to show *all* posts sorted
    // alphabetically by title
    $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(); ?>

    but when I replace the

    <?php while (have_posts()) : the_post(); ?>

    code on the archive page it shows nothing.

    can anyone help?

    thanks for your time.

Viewing 1 replies (of 1 total)
  • Thread Starter grishart

    (@grishart)

    Hi Have just found the answer.

    before the loop

    <?php while (have_posts()) : the_post(); ?>
    put

    <?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'); ?>

    It worked a treat!

Viewing 1 replies (of 1 total)
  • The topic ‘archive.php showing posts alphabetically’ is closed to new replies.