You can search for all posts matching a particular keyword on your site by opening the URL index.php?tag=keyword — this is by default what your displayed keywords link to.
Setting up a local search results page is easy and should work right out of the box for most users. Here’s what you need to look into if you want to customize the results page or if this feature isn’t working for you.
- Templates
By default, the plugin looks for a file named
keywords.phpin your active template’s directory. If it can’t find this file, it will try (in order)tags.php,category.phporindex.php. This template file controls what the keyword search results will look like. To create your own results template, createkeywords.php(ortags.php) by copying one of your existing templates. I would suggest usingsearch.phporcategory.phpas a starting point. You can then customize the layout and text of this template file. To display the name of the keyword being searched you can use<?php the_search_keytag() ?>Note: the functionget_the_search_keytag()is a non-echoing version. - Rewrite Rules
If you are using
mod_rewritefor your permalinks, the plugin will automatically add the necessary rules to your.htaccessfile whenever you update your permalink settings. Make sure that you re-save your permalink settings in Options-Permalinks after installing this plugin. If WordPress cannot write to your.htaccessfile, you will need to add the following lines by hand (ignore this if you don’t use permalinks):RewriteRule ^tag/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /index.php?tag=$1&feed=$2 [QSA,L] RewriteRule ^tag/(.+)/(feed|rdf|rss|rss2|atom)/?$ /index.php?tag=$1&feed=$2 [QSA,L] RewriteRule ^tag/(.+)/page/?([0-9]{1,})/?$ /index.php?tag=$1&paged=$2 [QSA,L] RewriteRule ^tag/(.+)/?$ /index.php?tag=$1 [QSA,L]
I’ve created a keywords search results template file that you can use with the Kubrick (default) theme.