/
template-news.php
68 lines (55 loc) · 2.21 KB
/
template-news.php
1
<?php/* * Template Name: News */global $hnmOpt;?><?php get_header(); ?> <div class="first-section p82-topbot"> <div class="container"> <div class="row"> <?php $subtitle = get_post_meta( get_the_ID(), 'page_subtitle', true ); ?> <?php if( !empty( $subtitle ) ): ?> <div class="col-sm-12"> <h2 class="title-grp"><?php echo $subtitle; ?></h2> </div> <?php endif; ?> <?php $news_args = array( 'post_type' => 'post', 'posts_per_page' => -1 ); if( isset($hnmOpt['news_cats']) && !empty($hnmOpt['news_cats']) ) { $news_cats = $hnmOpt['news_cats']; $news_args['tax_query'] = array( array ( 'taxonomy' => 'category', 'field' => 'id', 'terms' => $news_cats, ), ); } $news = new WP_Query( $news_args ); ?> <?php if ( $news->have_posts() ) : while ( $news->have_posts() ) : $news->the_post(); ?> <div class="col-sm-12"> <div class="news-covering"> <div class="col-sm-2 image-section"> <?php the_post_thumbnail( 'news-updates' ); ?> <h2><?php echo get_the_date(); ?></h2> </div> <div class="col-sm-10 news-detail"> <h2> <?php the_title(); ?> <span><?php printf( __( 'by : %s', 'hnm' ), get_the_author_link() ) ?></span> </h2> <?php the_excerpt(); ?> </div> </div> </div> <?php endwhile; wp_reset_postdata(); endif; ?> </div> </div> </div><?php get_footer(); ?>