Change loop.php for empty search customization

I feel bad for answering my own question on here, but here’s what I did. I created a custom search template, a custom searchform.php and changed my header.php to reflect my custom search page. What I did is rename the search box names to search instead of s to get around WordPress automatically running search.php … Read more

Search result by range?

If you save the the price in a meta field, you can query posts using meta_query: <?php $the_posts = new WP_Query( array( ‘meta_key’ => ‘price’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘meta_query’ => array( array( ‘key’ => ‘price’, ‘value’ => ‘100’, ‘type’ => ‘NUMERIC’, ‘compare’ => ‘>=’ ) ) )); ?> <?php while ( $the_posts->have_posts() … Read more

Combine internal search with Google custom search?

The standard search results can also be formatted with a theme file, by default search.php. You don’t need to create a “fake” page for that. If you don’t include any content from the page, and only use the theme file, you can just rename searchpage.php to search.php and it will work. If you do have … Read more

Replace default WordPress search behavior with Sphinx

The Sphinx Search website lists three wordpress plugins on its Plugin Page. Maybe one (or more) of them does what you want? Voce Connect. WordPress Plugin. Ivinco. WordPress Plugin. Gigaom. WordPress Plugin. Filters WordPress’ core WP Query to allow interoperability with and improve performance of other plugins and existing queries, including core taxonomy queries.

Need to do blank search.

You can pass s=%20 as your search string, but thats kinda hackish. If what you are trying to achieve is to use your search.php template but with “controled” search results, consider using this: <?php global $query_string; // fetch query string being used query_posts($query_string . ‘&posts_per_page=20’) // add your terms to it. ?>

WordPress search issue with searching html tags

You could try using several regexps to only search outside angle brackets: function wpse159789_posts_search( $search, $query ) { global $wpdb; if ( ! preg_match( “https://wordpress.stackexchange.com/” . $wpdb->posts . ‘\.post_content LIKE \’%(.+)%\”https://wordpress.stackexchange.com/”, $search, $matches, PREG_OFFSET_CAPTURE ) ) { return $search; } $search_str = stripslashes( $matches[1][0] ); // Cater for closed angle pairs embedded in the search … Read more