Skip to content

Instantly share code, notes, and snippets.

@hadamlenz
Last active February 2, 2017 18:25
Show Gist options
  • Save hadamlenz/cb673b1163032efdaf95df4bee0a0e4d to your computer and use it in GitHub Desktop.
Save hadamlenz/cb673b1163032efdaf95df4bee0a0e4d to your computer and use it in GitHub Desktop.
<?php
$search = new WP_Query( array(
's' => $qv,
'posts_per_page' => 30,
'paged' => $paged,
'post_status' => array( 'publish', 'future' )
));
$search->query_vars['searchblogs'] = '1,8,9,16,18';
relevanssi_do_query($search);
if( $search->have_posts() ) :
while( $search->have_posts() ) :
$search->the_post();
switch_to_blog($post->blog_id);
$thisPostType = get_post_type();
$filterlink = sprintf('.?s=%s&page=%d&post_type=%s', get_query_var( 's' ), 1, $thisPostType);
?>
<section class="search-result">
<h4><a class="search-result-link href="<?php the_permalink() ?>"><?php relevanssi_the_title(get_the_ID()) ?></a></h4>
<small><a href="<?php echo $filterlink ?>"><?php echo get_post_type() ?></a> |
<a href="<?php the_permalink() ?>"><?php the_permalink() ?></a></small>
<?php relevanssi_the_excerpt() ?>
</section>
<?php
restore_current_blog();
endwhile; endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment