Using WordPress as an Inventory Catalog Pt.7

Two more features that seem necessary to an inventory are searching and a tag list.  A quick look at codex.wordpress.org shows that there are two basic parts to their built-in search engine.  The search field and button, and the search results page.

Stick this code in your sidebar or wherever you want the search field and submit button to show up on your website: “<?php include (TEMPLATEPATH . ‘/searchform.php’); ?>”

Then you have to create a page which is where the search results will show up.  Copy your inventory page and call it searchform.php.  Put it in the same directory as your inventory page.  Cut out the section of your page that starts with “<?php if (have_posts()) : ?>” and ends with”<?php endif; ?> “.  This is called “the loop” and usually is inside your content div.  Replace it with “<?php /* Template Name: Search Page */ ?>”.  That should do it!

Now to add a tag list or cloud.  This shows you a list of all the tags you use on your inventory so people can see features or descriptive words of your inventory and click on them to see a list of items that are tagged.  Put this code in your sidebar or wherever: “<?php wp_tag_cloud(”); ?>”.  The default format is as a cloud, where the tags with the most use are in bigger sized fonts.  To make them show up as a list use “<?php wp_tag_cloud(’format=list’); ?>”.

The search needs more capabilities, like being able to click checkboxes to search for specific keywords, and select price ranges and the like, but I haven’t found any info on that yet…

Comments (0)