Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php /*
- TEMPLATE PART TO DISPLAY RELATED TIPS
- */
- $scores = the_related_get_scores(); // pass the post ID if outside of the loop
- $posts = array_slice( array_keys( $scores ), 0, 5 ); // keep only the the five best results
- $args = array(
- 'post__in' => $posts,
- 'post_type' => 'my_type',
- 'posts_per_page' => 5,
- 'caller_get_posts' => 1 // ignore sticky status
- );
- $query = new WP_Query( $args );
- if ( $query->have_posts() ) { ?>
- <h4>Related Posts</h4>
- <ul>
- <?php while ( $query->have_posts() ) {
- $query->the_post();
- ?>
- <li><a href="<?php echo get_permalink(get_the_ID()); ?>"><?php the_title(); ?></a></li>
- <?php } /* end while */ ?>
- </ul>
- <?php } /* end if */ ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement