[wp-hackers] Custom search form on wordpress as CMS

Jennifer Hodgdon yahgrp at poplarware.com
Fri Aug 1 16:04:34 GMT 2008


What do you want to search for -- what are all the drop-downs and 
check boxes used for? If they are standard WordPress things like 
categories, tags, post IDs, etc., you can probably just use 
WordPress's standard querying mechanism. For instance, if you set up 
your search form so that it will send the GET request:
    (your blog URL)?cat=1&s=software
it will search for all the posts containing the word "software" in the 
category whose ID is 1. This makes use of the WordPress query variable 
"cat" (category ID) as well as "s" (search term).

You can find out what the standard WordPress query variables are by 
looking at the top of wp-includes->classes.php, at the 
WP->public_query_vars variable definition... though it may not be 
obvious what all of them are. I'm not aware of any documentation on 
their meanings, but you can look at WordPress URLs (with permalinks 
turned off) to get ideas.

If you are searching for things other than what WordPress has in its 
query variables, you will probably need to write a plugin to do the 
querying behind your search box. There are some examples of how to do 
this here:
     http://codex.wordpress.org/Custom_Queries

Good luck!
   --Jennifer

mailapera wrote:
>  Do you know a way to enable wordpress to use complex search forms? I need
> combo boxes (drop down), and check boxes only in this form. How would I pass
> all the variables to the algorithm and store the data in the DB? It seems
> the only search possible is the in site google kind of search, with one open
> text field only. I have seasrched the web extensively but could not find
> anything.

-- 
Jennifer Hodgdon * Poplar ProductivityWare
www.poplarware.com

Drupal/WordPress Sites, Themes, Modules/Plugins
Custom Web Programming, Web Databases
PHP, Perl, MySQL, JavaScript, XML, AJAX



More information about the wp-hackers mailing list