Is there An Input Checkbox Option That Works like `wp_dropdown_categories()` To Use In A WP Search Form?

Yes, there is a built-in WordPress function you can use to render a list of checkboxes (or simply, checklist) which then allows the user to select multiple terms, and the function is wp_terms_checklist(). However, the function only works for users who have the capability/permission to assign terms to a post, so you’d need to create … Read more

Force WP to use a certain search template

You can use template include filter to use it on every search request. Let’s assume the advanced search page template you are using is ‘wp-advanced-search.php’ you can use locate_template to get its path: add_action(‘template_include’, ‘advanced_search_tmpl’); function advanced_search_tmpl( $template ) { if ( is_search() ) { $t = locate_template(‘wp-advanced-search.php’, false); if ( ! empty($t) ) $template … Read more

Include Author profile in search results

If you have a user role called “consultant” and you do a search filtering by capability “consultant”, you wouldn’t find anything. Roles and capabilities are different things. Here is the codex reference: http://codex.wordpress.org/Roles_and_Capabilities

Display WordPress Search

Tom, You’re right! I didn’t know how templates function, this was not something major, I just wanted to get that value and then display that value on my single.php page – but now I see that’s not how WordPress works. I decided to just leave off that functionality 🙂 Thanks, Josh

How can i display 3 post types in same page?

Make sure that your registration arguments for your post types have the public argument set to true or, alternately, publicly_queryable set to true and exclude_from_search set to false. Then, modify your search query by hooking into the pre_get_posts action: function filter_search( $query ) { $postTypes = array( ‘post’, ‘post_type1-Movies’, ‘post_type2-Trailers’, ‘post_type3-Subtitrari’ ); //Here you can … Read more

How do I change WP search results order?

You can use the action hook posts_orderby in your child themes functions.php: function changeSearchSort( $orderby, $query ){ global $wpdb; if(!is_admin() && is_search()) { $orderby = $wpdb->prefix.”posts.post_date ASC”; } return $orderby; } add_filter(‘posts_orderby’,’changeSearchSort’,10,2);

jQuery UI Autocomplete showing all results

You get all terms because you’re asking for all terms, in fact, the line $tradeList = get_terms(‘trade’); just get all the terms, ignoring the ‘term’ query string passed to file. If you want to get all the terms “filterd” you have to use the string in the query, something like: include_once( ‘../../../wp-load.php’ ); // adjust … Read more

WP-PageNavi plugin doesn’t work with multiple pages of search results

I discovered that the problem was in my theme’s searchform.php file. I changed the form method from “post” to “get.” Now search queries show up in the url address. Before: <form action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>” method=”post”> After: <form action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>” method=”get”> Problem solved.

WordPress Search Filter Only for Page with Child of Child of Child of Child of Child

You can probably do something like this. It’s probably less efficient, but should find all descendants of a given page rather than just direct children. function find_descendants($post_id) { $descendant_ids = array(); $pages = get_pages(“child_of=$post_id”); foreach ($pages as $page) { array_push($descendant_ids, $page->ID); } return $descendant_ids; } function SearchFilter($query) { if ($query->is_search) { $query->set ( ‘post__in’, find_descendants(21) … Read more