Make WordPress Search for Both Main Domain and Subdomain
Make WordPress Search for Both Main Domain and Subdomain
Make WordPress Search for Both Main Domain and Subdomain
Try something like that The reverse of this: https://wordpress.stackexchange.com/a/209714/180599 <?php global $wpdb; //The reverse of this: https://wordpress.stackexchange.com/a/209714/180599 $supported_mimes = array( ‘image/jpeg’, ‘image/gif’, ‘image/png’, ‘image/bmp’, ‘image/tiff’, ‘image/x-icon’ ); $all_mimes = get_allowed_mime_types(); $accepted_mimes = array_diff($supported_mimes, $all_mimes); //and… $keyword = stripslashes($_REQUEST[‘keyword’]); //$search = $wpdb->get_col( $wpdb->prepare( ” SELECT DISTINCT ID FROM {$wpdb->posts} WHERE post_title=”%s” OR post_content=”%s” “, $keyword, $keyword … Read more
Automatically adding category filter based on search string
Custom Post Type not appearing in website search
There are a couple of plugins that provide this functionality: Google Custom Search Plugin Google Ajax Search
Try this: add_filter(‘wp_nav_menu_items’,’search_box_function’); function search_box_function { search box code goes here } For reference, check out Bill Erickson’s excellent tutorial on accomplishing this with the Genesis framework.
global $wp_query; echo $wp_query->found_posts;
Perhaps you can use this plugin: http://wordpress.org/extend/plugins/multisite-global-search/ it uses MySQL views to achieve a global search. Maybe you can use it, or adapt it to your needs?
Managed to figure it out by adapting that code from the link i posted: function atom_search_where($where){ global $wpdb; if($_SESSION[‘js’] != ”) $where .= “OR (t.name LIKE ‘%”.trim($_SESSION[‘js’]).”%’ AND {$wpdb- >posts}.post_status=”publish”)”; $where .= “OR ($wpdb->postmeta.meta_key = ‘_job_ref’ AND $wpdb->postmeta.meta_value=””.$_SESSION[“js’].”‘)”; return $where; } function atom_search_join($join){ global $wpdb; if($_SESSION[‘js’] != ”) $join .= “LEFT JOIN {$wpdb->term_relationships} tr ON … Read more
Try $tax_query = array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘marque’, ‘terms’ => array( 70, 67 ), ‘field’ => ‘term_id’, ‘operator’ => ‘NOT IN’ ) ); //turn it into a WP_Tax_Query object… $tax_query = new WP_TaxQuery($tax_query); $query->set(“tax_query”, $tax_query);