Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $args = array(
- 'post_type' => array( 'post' ),
- 'post_status' => array( 'publish' ),
- 'posts_per_page' => '9',
- );
- $query = new WP_Query( $args );
- if ( $query->have_posts() ) {
- while ( $query->have_posts() ) {
- $query->the_post();
- $postdate = get_the_date('F j, Y');
- $posts .= '<div class="row">
- <div class="post-single">
- <div class="thumb" style="background:url('.wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' )[0].');"></div>
- <div class="title">
- <a href="'.get_the_permalink().'">
- <h4 class="news-title">'.get_the_title().'</h4>
- </a>
- <div class="post-details">
- <i class="fa fa-calendar" aria-hidden="true"></i> '.$postdate.' <span class="divider">|</span> ';
- foreach((get_the_category()) as $category) {
- $posts .= '<span class="category-badge">'. $category->cat_name .'</span>';
- }
- $posts .= '</div>
- </div>
- <div class="excerpt">'.get_the_excerpt().'</div>
- </div>
- </div>';
- }
- } else {
- $posts .= 'Sorry, we were not able to find any News Updates that you have access to.';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement