March 21, 2014 at 9:18 am
#1473
Ernest Marcinko
Keymaster
It depends on various things, but the id is not really predictable.
If you use only one search for each blog and the same template for all the sites, then editing the search shortcode is most likely the best solution for you.
Open up the plugins/ajax-search-pro/includes/shortcodes.php and go to line 88:
$search = $wpdb->get_results("SELECT * FROM ".$_prefix."ajaxsearchpro WHERE id=".$id, ARRAY_A);
and change this line to:
$search = $wpdb->get_results("SELECT * FROM ".$_prefix."ajaxsearchpro", ARRAY_A);
plus add this line after line 99:
$id = $search[0]['id'];
This change in the shortcode will generally ignore the search id and selects the first one found on each sub-site. Now you can use the same template for each site with any search shortcode, like:
<?php echo do_shortcode('[wpdreams_ajaxsearchpro_results id=0 element="div"]'); ?>
because the id doesn’t matter anymore.