Search results to be only posts & children of page ID

The only way I could figure it out was to build a list of ID’s to exclude like this: /* * Hide some pages from search results */ function SearchFilter($query) { if ($query->is_search) { $exclude=”18,20,12,22,132,76,81,78,84,91″; // Get all children of #18 $pages = get_pages(‘post_parent=18’); foreach($pages as $child) { $exclude .= “,” . $child->ID; } $query->set(‘post__not_in’, … Read more

Can’t place two custom post types into the WordPress search query?

Try to drop that in your functions.php file: function filter_query_for_search( $query ) { if ( isset( $query[‘s’] ) ) { $query[‘post_type’] = array(‘forum’, ‘topic’, ‘reply’, ‘any’); } return $query; } add_filter(‘request’, ‘filter_query_for_search’, 1); that would hook into the query just before its being executed.

Checkboxed term search

I built something similar for a client not too long ago. I believe your question is if it is possible — I can definitely say yes there. How would you go about it? Well, as I don’t have the code handy, I’ll give you a brief run-down of the steps I went about. I made … Read more

Search URL redirect problem

You must be using an image button for your submit. It sends the x and y coordinates of where the button was clicked as well as any other get parameters. I would recommend using a standard submit button and then use CSS to replace it with an image. Alternatively if you don’t know CSS a … Read more

conditional search

solution 1: this can be done by adding the drop down menu to the search form.eg cat_slct create a search template if its not exist in your theme. add an if statement at the top of the page and directly after get_header(); – if(isset($_POST[‘cat_slct’])){ //make the query using the name of the categoty you’v just … Read more

Taxonomy or Custom Field

I’m not sure why an Author post-type has a “title” taxonomy, unless you meant books or something, or even why you can’t use the built-in published date field, but here goes: Store the date published as a timestamp in a custom field. You can do the conversions behind the scenes and just show users the … Read more

Searching with Multiple (Parallel) Criteria on Custom Fields?

have a look at WP_Query(); and use meta_query / tax_query arguments $args = array( ‘post_type’ => ‘product’, ‘meta_query’ => array( array( ‘key’ => ‘color’, ‘value’ => ‘blue’, ‘compare’ => ‘NOT LIKE’ ), array( ‘key’ => ‘price’, ‘value’ => array( 20, 100 ), ‘type’ => ‘numeric’, ‘compare’ => ‘BETWEEN’ ) ) ); $query = new WP_Query( … Read more

Why does this search.php not work?

I see at least two potential issues: You have if ( have_posts() ) : twice. Here: <?php if ( have_posts() ) : ?> <h1 class=”page-title”><?php printf( __( ‘Search Results for: %s’, ‘nothing’ ), ” . get_search_query() . ” ); ?></h1> And here: <ul id=”post-list”> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> The get_template_part() … Read more