• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

nSiteful Web Builders

Building a Better Web - One Site at a Time.

  • Home
  • About
    • Testimonials
  • Web Sites
  • Online Marketing
  • WordPress Support
    • Customized WordPress Training
  • Web Applications
  • Blog
    • Archive Listing Minimalistic
    • Blog Articles Grouped by Category
    • Case Studies
    • General
    • Portfolio
    • Reviews
    • Snippets
    • Techniques
  • Contact Jeff
    • Purchase Retainer Consulting Hours
    • About Retainer Consulting Hours
Categories and Tags links

By Jeff Cohan, October 26, 2018

Help Your Blog Readers Find What They’re Looking For with the Search & Filter Plugin

This article shows you how you can use a simple, lightweight plugin to make it easier for your Web visitors to find what they’re looking for in your blog. The plugin, Search & Filter, is one I installed long ago, deactivated because I hadn’t followed directections, and then forgot about — until just the other day.

And isn’t making our visitors’ experiences better what it’s all about?

Preface: How I Structure Blog Posts

In the Web sites I build, and especially in my own, I try hard to utilize taxonomies (usually Categories and Tags) to organize blog articles in ways that make it easy for visitors to find what they’re looking for.

Taxonomies are nothing more than ways to group content.

I tend to use categories as broad, mutually exclusive classifications. In other words, I assign only one category to each blog post. Also, I try to use only a few catetories. The current categories in this blog are:

  • Case Studies
  • First Looks
  • General
  • Reviews
  • Snippets
  • Techniques

As for tags, I use them in a “many-to-many” fashion, and I use a lot of them. Tags are topics (in the case of this blog, CSS, WordPress, php, etc.). Each blog post could be assigned multiple tags, and any given tag could (actually should, or else you’re doing it wrong) be assigned to multiple posts.

As I wrote in this blog post from years ago, I think of categories as the chapters in a book’s table of contents and tags as the entries in a book’s index.

How Visitors Use Categories and Tags

Many blog readers know they can view a listing (archive, in WordPress parlance) of posts in a certain category or assigned a certain tag by clicking on the category/tag links that typically appear at the top or bottom of a blog post.

Filter Blog Posts by Categories and Tags links

I do this all the time when reading others’ blogs. It’s potentially a helpful time-saver.

But I’ve often wished for something better than having to choose between the category archive and the tag archive.

The Problem:

Suppose I were a visitor to this blog and I’m pressed for time and I’m particularly interested in finding useful php snippets. Maybe I’ve visited before and found some useful ones, and I want to see if any new php snippets have been added.

To address this issue, and to make it even easier for visitors to find what they want on my blog, I created a custom listing of posts grouped by category. Check it out here; the page will load in a new browser window so you can continue reading this article.

By clicking on “php” in the tag cloud or at the bottom of a post, I’d see a listing of all posts tagged “php”. But that listing would include posts in all categories.

Or I could click on the “Snippets” category link and get a listing of all snippets. But that listing would include posts about all kinds of snippets — WordPress, JavaScript, CSS, etc., in addition to php.

Sure, I could navigate through all the archive pages and scan for the php snippets posts. But that isn’t ideal.

The Solution

Yesterday I discovered in one of my sites a plugin I had deactivated months ago because it couldn’t do — or so I thought — something I wanted it to do.

The plugin is Search & Filter, and it turns out the problem was due to user error.

Search & Filter purports to be an improvement over the standard WordPress search box. This, from the description at the WordPress repository (emphasis mine):

You can search by Category, Tag, Custom Taxonomy, Post Type, Post Date or any combination of these easily to really refine your searches – remove the search box and use it as a filtering system for your posts and pages. Fields can be displayed as dropdowns, checkboxes, radio buttons or multi selects.

It was the part about using the plugin as a filtering system that caught my eye and interest.

Warning/Disclaimer

There is a bug in version 1.2.10 of the plugin, which can be fixed in 20 seconds by anyone who knows how to edit and FTP a php file (see below). The plugin author announced 16 months ago that he plans to update the plugin (which he has not done) and that he will not offer support in the meantime (also which he has not done). Not wonderful.

The Bug and How to Fix

Depending on the version of php your site uses, you may get this error:

Warning: Invalid argument supplied for foreach() in /home/[your_site]/public_html/wp-content/plugins/search-filter/search-filter.php on line 578

…and then other messages about “Headers already sent”.

Here’s the fix, thanks to @coffeehero in the plugin support forum:

Find this on line 578 of search-filter.php…

foreach($wp_query->query as $key=>$val)

…and change it to..

foreach((array) $wp_query->query as $key=>$val)

How to Filter Blog Posts with the Search & Filter Plugin

Installation is standard, and the plugin works by shortcode. I don’t need to tell you how the shortcode works, because all the documentation is here.

To achieve the filtering I’m looking for, I don’t even include the search box. If someone wants to search for a string of text, he/she can use the built-in search form, as far as I’m concerned. Remember, the problem I want to solve is helping someone find posts with a specific tag in a specific category — quickly and easily.

So, whether you’re looking for php (tag) Snippets (category), or WordPress (tag) Case Studies (category), or CSS (tag) Techniques (catetory), here’s the search form you can use (go ahead and try):

And here’s the shortcode:

[searchandfilter fields="category,post_tag" hide_empty="1,1" show_count="0,1"]

Final Thoughts

If you want to make it easier for your Web visitors to find what they’re looking for in your blog (and why wouldn’t you?), consider installing this lightweight (173 KB) plugin. Notwithstanding the above-referenced bug and lack of support, it’s a nifty solution.

By the way, remember that the plugin also supports custom post types, custom taxonomies, and post dates. You might want to use a more full-blown search form than I’m using.

Note: There’s a Pro version of the plugin which supports dynamic filtering, which prevents users from getting empty results. In other words, using my example, after selecting one category, the plugin will dynamically filter the tags that appear in the Tag dropdown, removing any tags not associated with the selected category and updating the counts of those that do. (Dynamic filtering also works in the other direction, if you select Tag first.) However, when I tested the demo for the pro version, I found the dynamic refresh too sluggish. YMMV.

You might also enjoy...

Default ThumbnailWordPress Categories and Tags screen capture of About Us blurbHow to add an About Us blurb to every WordPress blog post Default ThumbnailMaking Sense of WordPress Post Formats Read Blogs More Efficiently (and Enhance your Blog Reading Experience) Using Categories and Tags Tipsy WordPress Plugin from iThemes
  • Choose the best match.

Written by Jeff Cohan · Categorized: Techniques · Tagged: Plugins, WordPress

  • Choose the best match.

Reader Interactions

Comments

  1. Nana EL says

    April 12, 2019 at 11:26 pm

    [* Shield plugin marked this comment as “spam”. Reason: Human SPAM filter found “for your article” in “comment_content” *]
    Hello, thanks for your article, it made me reactivate the plugin. But i’m facing an issue i would you to assist me with. When i click on the submit or the search button it only displays the post heading and not the entire post. I need it to display the entire post with a picture and some other features but it only displays the post title. How do i get that fixed please. Thanks.

    Reply

Leave a Reply Cancel reply

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

Primary Sidebar

mailchimp signup

Subscribe to get notified when new articles are published. Unsubscribe any time. No spam. I promise. Check out my newsletter archives.

social

Twitter Facebook LinkedIn

Recent Articles

  • How To Add Custom Contextual Help Content To The WordPress Dashboard September 19, 2020
  • WordPress Manual Excerpts: Why, When, & How to Use Them August 12, 2020
  • How to Build Stunning WordPress Photo Galleries Quickly and Easily With FooGallery PRO June 17, 2020
  • How to Hide the Mai Lifestyle Pro Banner Area With Code June 15, 2020
  • Sharing Blog Posts on Social Networks: How and Why June 11, 2020

Filter By Category/Tag

Categories

  • Case Studies (7)
  • General (57)
  • Portfolio (4)
  • Reviews (11)
  • Snippets (13)
  • Techniques (33)

Popular Tags

Advanced Custom Fields Arrays Blogging Child Themes Content Marketing CSS Customer Service Custom Fields Custom Post Types Diagnostics Email Facebook FooGallery Genesis HTML Images iPhone Libra Live Chat Marketing Media MySQL NextGen Gallery PayPal Photo Gallery php Pinterest Plugins Post Formats Pricing Programming Project Management SEO Seth Godin Shortcodes Social Networking Surveys Tables Taxonomies Twitter Web design Web forms WordBooker WordPress YouTube

partners

siteground wp hosting

Web Hosting

Footer

Background

Web Sites | WordPress Support | Web Applications.

Formally trained in liberal arts and education (I have a B.A. in Government from Harvard and studied Secondary Education at Rutgers Graduate School), I have honed my skills in the communication arts and sciences as a teacher, trainer, instructional designer, writer, photographer, calligrapher, helpdesk manager, database programmer, and multimedia developer.

(I've also been a group counselor, waiter, bartender, bicycle messenger boy, computer salesman, carpenter's helper, financial analyst, and school board president.)

Tech

Systems since 1983.
Web sites since 1994.
PHP since 2001.
WordPress since 2007.

Contact

770-772-5134
Email Jeff
Send Money
All Ways

Copyright 2021, nSiteful Web Builders, Inc.

Subscribe

Pardon the interruption. I know popups can be annoying. But I’d love to have you as a subscriber.

Sign up to be notified when new articles are published. Unsubscribe any time.

* indicates required

Powered by MailChimp

×