Advertisement
Guest User

Untitled

a guest
Apr 15th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. $args = array(
  2. 'post_type' => array( 'post' ),
  3. 'post_status' => array( 'publish' ),
  4. 'posts_per_page' => '9',
  5. );
  6.  
  7. $query = new WP_Query( $args );
  8.  
  9. if ( $query->have_posts() ) {
  10. while ( $query->have_posts() ) {
  11. $query->the_post();
  12. $postdate = get_the_date('F j, Y');
  13.  
  14. $posts .= '<div class="row">
  15. <div class="post-single">
  16. <div class="thumb" style="background:url('.wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' )[0].');"></div>
  17. <div class="title">
  18. <a href="'.get_the_permalink().'">
  19. <h4 class="news-title">'.get_the_title().'</h4>
  20. </a>
  21. <div class="post-details">
  22. <i class="fa fa-calendar" aria-hidden="true"></i> '.$postdate.' <span class="divider">|</span> ';
  23. foreach((get_the_category()) as $category) {
  24. $posts .= '<span class="category-badge">'. $category->cat_name .'</span>';
  25. }
  26.  
  27. $posts .= '</div>
  28. </div>
  29. <div class="excerpt">'.get_the_excerpt().'</div>
  30. </div>
  31. </div>';
  32.  
  33.  
  34. }
  35. } else {
  36. $posts .= 'Sorry, we were not able to find any News Updates that you have access to.';
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement