Global Product Search with Thumbnails - SOLVED!

This little bit of magic comes from a fellow WPMU-DEV member: cstevenson.

Using the Global Site Search & Marketpress, cstevenson has been able to display the product thumbnail instead of the member avatar. You can see it in action here:

Replace line 328 of global-site-search.php with this:

$content .= '<tr>';
$switchblog = $post['blog_id'];
$content .= '<td style="background-color:' . $bg_color . '; padding-top:10px;" valign="top" width="10%"><center><a href="' . $post['post_permalink'] . '">' . get_the_post_thumbnail($post['post_id'], 'thumbnail') . '</a></center></td>';

Now I have added this global site search to my buddypress search box, here's how:

In Buddypress/bp_core/bp-core-template.php after line 260 add this:

$selection_box .= '<option value="products">' . __( 'Products', 'buddypress' ) . '</option>';

This adds Products to the start of the drop down list.

Then in Buddypress/bp_core/bp-core-functions.php just after line 839 in the switch statement, add this:

case 'products':
				$slug = 'site-search';
				$query_string  = '/';

Just make sure in the global site search you have selected the custom post type products for the search.

That's it, 3 easy steps! :slight_smile:

Now to get them to display in a grid...I have an idea, if it works out I will add it here.