Reply To: Problem with multisite?

Ernest Marcinko
Ernest Marcinko

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.

Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)