Guest User

Related Posts

a guest
Jun 21st, 2013
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <?php
  2.  
  3. global $relatedargs, $relatedcatargs;
  4. // Query Posts by tag
  5. $my_query = new WP_Query($relatedargs);
  6.  
  7. //If there are posts
  8. if( $my_query->have_posts()) { ?>
  9.  
  10. <!-- Related Posts -->
  11. <div class="relatedposts">
  12. <h3><?php _e('Related Posts', 'framework'); ?></h3>
  13.  
  14. <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
  15.  
  16. <a href="<?php the_permalink();?>" class="one_col half">
  17. <div class="featuredinner">
  18. <h2><?php
  19. if (strlen($post->post_title) > 40) {
  20. echo substr(the_title($before = '', $after = '', FALSE), 0, 80) . '...';
  21. } else {
  22. the_title();
  23. } ?>
  24. <span class="date"><?php the_time(get_option('date_format')); ?> | <?php echo get_the_author(); ?></span></h2>
  25. <div class="featuredoverlay"></div>
  26. <?php the_post_thumbnail('blogonecol', array('class' => 'scale-with-grid')); /* post thumbnail settings configured in functions.php */ ?>
  27. </div>
  28. </a>
  29.  
  30. <?php endwhile; ?>
  31.  
  32. <div class="clear"></div>
  33. </div>
  34. <?php } wp_reset_query(); // end if there are posts and reset the query?>
Advertisement
Add Comment
Please, Sign In to add comment