Keyword search in multiple categories

let’s start by defining an HTML search form: <form method=”get” action=”<?php bloginfo(‘url’); ?>”> <fieldset> <input type=”text” name=”s” value=”” placeholder=”search&hellip;” maxlength=”50″ required=”required” /> <p>Refine search to posts containing chosen tags:</p> <?php // generate list of categories $tags = get_categories(); foreach ($tags as $tag) { echo ‘<label>’, ‘<input type=”checkbox” name=”taglist[]” value=”‘, $tag->slug, ‘” /> ‘, $tag->name, “</label>\n”; … Read more

Add Icon to Placeholder Text in Search Form

If you’re using FontAwesome, you can display an icon in the placeholder text like this : HTML <input placeholder=”&#xf0e0;” class=”fontAwesome”> CSS .fontAwesome{ font-family: ‘Helvetica’, FontAwesome, sans-serif; }

Search Query for Multiple Terms In Same Taxonomy

You need to make only one change in the form, change the first line to: <select name=”property_type[]” class=”form-control” multiple> Name of the field has to include [] to be considered as an array when it arrives on the server side. In the query string it will be listed as: property_type[]=condo&property_type[]=duplex And, on server side, when … Read more

Can NOT search my custom post type?

did you try if (!isset($post_type)) or if(empty($post_type))?? For example I would try this: function mySearchFilter($query) { $post_type = $_GET[‘post_type’]; if ($query->is_search) { if (!empty($post_type)) { $query->set(‘post_type’, $post_type); } } return $query; } add_filter(‘pre_get_posts’,’mySearchFilter’); EDIT: Here is my working example code: Here is my CPT used for testing: add_action( ‘init’, ‘register_cpt_website_bookmarks’ ); function register_cpt_website_bookmarks() { $labels … Read more