Guest User

Untitled

a guest
May 24th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. <?php
  2. $posts = $wpdb->get_results('SELECT * FROM wp_posts WHERE ID IN(SELECT post_id FROM wp_postmeta WHERE meta_key="territories" AND meta_value='.$post->ID.') ORDER BY post_date DESC LIMIT 5');
  3.  
  4. if(empty($posts)){
  5. echo 'The Monkey Rats have aborted...';
  6. }else{
  7. foreach($posts as $post){
  8. setup_postdata($post);
  9. ?>
  10. <li>
  11. <h3><a href="<? the_permalink() ?>"><? the_title() ?></a></h3>
  12. </li>
  13. <?
  14. }
  15. }
  16. ?>
Add Comment
Please, Sign In to add comment