Instantly share code, notes, and snippets.

@billerickson /single.php Secret
Last active Oct 24, 2018

Embed
What would you like to do?
<?php
/**
* Related Posts
* @see https://www.billerickson.net/related-posts-with-searchwp/
*
*/
function be_related_posts() {
$loop = new WP_Query( array(
'post__in' => ea_get_related_posts( 3 ),
'orderby' => 'post__in',
) );
if( $loop->have_posts() ):
while( $loop->have_posts() ): $loop->the_post();
get_template_part( 'partials/archive' );
endwhile;
endif;
wp_reset_postdata();
}
add_action( 'genesis_after_entry', 'be_related_posts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment