Support » Plugins » Search Results in Alphabetical or Relevant Order?

  • I hope this isn’t in the forums somewhere else, but I’ve been wondering if someone could help me with getting my search results to display in alphabetical (title) and not chronological order. What or how can this be done?

    Also, is there a way to search based on relevance?

    Any help is appreciated, as I’m getting pretty frustrated. Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • If you have a search.php template with your theme, insert this in it just above The Loop:

    <?php query_posts('orderby=title&order=ASC'); ?>

    If you don’t have a search.php, you can copy the theme’s archive.php (or if *that* is not available, index.php) for it. Alternatively, you could use the following in archive.php/index.php:

    <?php if(is_search()) {
    } ?>

    More info on query_posts():

    Also, is there a way to search based on relevance?

    Plugin you may want to check out:

    thanks for the direction!

    Nice Kafka, though I don’t understand the relevance. If I am searching for something on “blah”, the title would be irrelevant. Just because it starts with an “A” doesn’t mean it contains the information for which I am looking ;-).


    <?php query_posts(‘orderby=title&order=ASC’); ?>

    does get the search results in alphabetical order, but the navigation to next and previous search results pages no longer works. I can’t see more than the first page of search results.

    Moderator James Huff


    Volunteer Moderator 🚀

    Is there any documentation for that plugin? I can’t find any ways to configure it.

    I tried adding this to search.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(); ?>

    (found at: but I get the same non-functioning next and previous buttons. Does this indicate that something is broken?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Search Results in Alphabetical or Relevant Order?’ is closed to new replies.