Wordpress Results Count

I know that this site is running on Drupal, but I have another site that runs on Wordpress.

Because this site is based mainly on collated articles, it contains a lot of text, meaning that searches often return many pages of results, particularly for common search terms. On search engines such as Google, it says at the top of results pages something like: Results 1 - 100 of 172. I set out to create a plugin that would do the same thing with Wordpress.

For an example of the plugin in use, look at the top of any of the archive or category pages at http://www.elginism.com/archives/acropolis/, an archive with multiple pages of results.

As I haven't come across a similar plugin, I'm releasing it for free under the GPL license, for anyone else who may find it useful.

If you have any queries or suggestions for how the plugin could be improved, please could you add them to comments on this page.

To get the plugin, use the download link at the end of this page.

Installation

1. Upload `results-count.php` to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Place `<?php wp_searchheader()?>` in your templates, where you want the text generated by the Results Count plugin to occur.

If you want to ensure that the plugin is installed first to stop errors with the template when it is disabled, then instead use the code:

<?php if (function_exists('wp_searchheader')) : ?>
<?php wp_searchheader()?>
<?php endif; ?>

Which will then automatically check for the plugin before trying to execute it.

Revision history

  • Version 0.4.2

Adds support for Author archives.
Fixes bug where output does not display correctly when there are over 999 results.

  • Version 0.4.1

Fixes incorrect display for single day archive pages.

  • Version 0.4

Alters the text when there is only a single result on the page.
Corrects bug so that the correct text displays when there is only a single page of results.
Displays correct text when a year archive is shown rather than a month.
Tidied up text to fix some grammatical errors.
Various non-critical bugs fixed & old code tidied up.
Comments added in the html output to help error tracing, identifying the code produced by the plugin.

  • Version 0.3

Adds compatibility with tags (introduced in Wordpress 2.3), so headers will now show up for tag archive results.

  • Version 0.2

Updates the plugin to work with version 2.3 & higher of Wordpress.

  • Version 0.1

Initial public release of the code in plugin form.

Download it

The latest version of the plugin can be downloaded from the plugin repository at Wordpress.org

The it here:

http://wordpress.org/extend/plugins/results-count/

Comments

Nice plugin. I've just

Nice plugin. I've just installed it and I'm loving it. I've got some questions about it. How to show the result count for tag pages? I got it for search/archives, but don't know where to insert the code to get it to work with the tags archives. Also, in your screenshots, it seems that it's linking to each term (don't know if it's to the search page or anything else), is it the default behaviour of this plugin? As I didn't get that result.

With regards

Yeah you're the man

Hey thanks so much for this plugin ive been looking for a while now and i was really just hoping to find a sql query to display the count on tag pages. This beats that so hard! Thanks man!

Fine plugin! I just wonder

Fine plugin! I just wonder why it doesn't display "Showing 0 results for" if there is no search result. It just says "Showing results for ..." and leaves an empty space between "Showing" and "results" Could this be a matter of compatibility with WP 2.7.1? Or can I try to change it in the code?

Thanks,
Michael

Are you referring to search

Are you referring to search results pages, or is it a category or something like that which is empty?

 

If I do a search for a word that is not mentioned on my site it just says:

"Not Found

Sorry, but no posts matched your criteria."

 

I'm not sure why it would be acting differently to this - do you have a page on your site where this is occuring that you could link to?

cool

hi. Thanks for plugin

perfect.

Regards

I used plugin

I think it's best plugin for search count and ever know by common people but in using this plugin i need ignore a word such as in, on, for, of, the, a, would you like to modified again your plugin i will inserted plugin in my admin for next time.

Best Regards

Iroel

I think that what you are

I think that what you are trying to do is something that would need to modify the way the search command istelf works & is not something within the scope of this plugin.

The plugin merely counts the results returned (from searches, archive operations etc) & summarises this information.