Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2. global $post;
  3. $categories = get_the_category();
  4. foreach ($categories as $category) :?>
  5. <ul>
  6. <?php
  7. $posts = get_posts('numberposts=3&category='. $category->term_id);
  8. foreach($posts as $post) : ?>
  9. <li>
  10. <a href="<?php the_permalink(); ?>">
  11. <?php the_title(); ?>
  12. </a> </li>
  13. <?php endforeach; ?>
  14. <?php endforeach; ?>
  15. </ul>
  16.  
  17. <?php
  18. $currentPostID = $post->ID;
  19.  
  20. global $post;
  21. $categories = get_the_category();
  22. foreach ($categories as $category) :?>
  23. <ul>
  24. <?php
  25. $posts = get_posts('numberposts=3&category='. $category->term_id);
  26. foreach($posts as $post) : ?>
  27. <?php if ($currentPostID != $post->ID) {
  28. $test_value = get_post_meta( $post->ID, 'test', true );
  29. ?>
  30. <li>
  31. <a href="<?php the_permalink(); ?>">
  32. <?php if ( ! empty( $test_value ) ) {echo $test_value; } else { echo 'Nothing'; } ?>
  33. </a>
  34. </li><?php
  35. }?>
  36. <?php endforeach; ?>
  37. </ul>
  38. <?php endforeach; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement