PHP Developer

My notes and thoughts about Linux, WordPress, PHP and many more.

WordPress Sort Search Result by Title Plug-in

I am beginning to wonder how to sort search results in word press by post titles. There is a plugin below.


query_vars['orderby'] = 'title';
$k->query_vars['order'] = 'DESC';
}
}
?>

Readme/ Instructions:

1. Download the plugin here.

2. Upload to wp-content/plugins directory in wordpress

3. Activate the plugin.

3. So everytime there is a search query made in wordpress, it will sort alphabetically in descending or ascending order.

To sort post titles by ascending order, change the last line to:

$k->query_vars['order'] = 'ASC';

If you have problems with the plugin contact the developer.

9 thoughts on Wordpress Sort Search Result by Title Plug-in

  • It appears this plugin is not compatible with WP 3.5. It’s giving me errors all over the place. When I disable the plugin WP 3.5 works fine.

  • I would like to use this plugin but just updated to wordpress 3.5 and now receive an error message when I try to use it.

    “The plugin generated 355 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.”

    “Warning: Missing argument 2 for wpdb::prepare(), called in … on line 137 and defined in …/wp-includes/wp-db.php on line 990”

    Thanks.

  • Hi I was wondering how you would alter the code to use custom fields like price. I tried to simply change title to price in the php file however it didnt work. Any Suggestions are greatly appreciated.

    Thanks, Mike !

  • I would like to use this plugin but it is causing error message on my site (v.2.8.2) like this one:

    Warning: Cannot modify header information – headers already sent by (output started at /home/XXXX/public_html/XXXX/blog/wp-content/plugins/sort-searchresult-by-title/Sort_SearchResult_by_Title.php:21) in /home/XXXX/public_html/XXXX/blog/wp-includes/pluggable.php on line 865

    Any ideas? Thanks!

  • Hi Maxim, sorry but I cannot understand Russian language. Can you translate it to English please? Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.