Advertisement
Guest User

Selecting posts from Featured category

a guest
Oct 10th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. $featurePosts = new WP_Query('showposts=3&cat=1711');
  2. if ($featurePosts->have_posts()) {
  3. $strString = "<div class='featured'>";
  4. while ($featurePosts->have_posts()) : $featurePosts->the_post() ;
  5. $strString .= "<div class='featured-post'>";
  6. if ( has_post_thumbnail() ) {
  7. $imgattr = array(
  8. 'class' => "attachment-thumbnail",
  9. 'alt' => trim(strip_tags( get_the_title() )),
  10. 'title' => trim(strip_tags( get_the_title() )),
  11. );
  12. $strString .= '<a href="'. get_permalink().'" title="'. get_the_title() .'">' . get_the_post_thumbnail(get_the_ID(),'feature-thumb') . '</a>';
  13. }
  14. $strString .= '<p><a href="'. get_permalink().'" title="'. get_the_title() .'">'.get_the_title().'</a></p>';
  15. $strString .= "</div>";
  16. endwhile;
  17. $strString .= "</div>";
  18. }
  19. return $strString;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement