Advertisement
Guest User

University-hub-pro-customize

a guest
Apr 9th, 2019
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.40 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Template part for displaying home latest news section.
  4.  *
  5.  * @package University_Hub
  6.  */
  7.  
  8. $latest_news_title          = university_hub_get_option( 'latest_news_title' );
  9. $latest_news_layout         = university_hub_get_option( 'latest_news_layout' );
  10. $latest_news_number         = university_hub_get_option( 'latest_news_number' );
  11. $latest_news_column         = university_hub_get_option( 'latest_news_column' );
  12. $latest_news_category       = university_hub_get_option( 'latest_news_category' );
  13. $latest_news_featured_image = university_hub_get_option( 'latest_news_featured_image' );
  14. $latest_news_excerpt_length = university_hub_get_option( 'latest_news_excerpt_length' );
  15. ?>
  16.  
  17. <div id="latest-news" class="home-section-latest-news">
  18.     <div class="container">
  19.  
  20.         <h2 class="section-title"><?php echo esc_html( $latest_news_title ); ?></h2>
  21.         <?php
  22.         $qargs = array(
  23.             'posts_per_page' => absint( $latest_news_number ),
  24.             'no_found_rows'  => true,
  25.             );
  26.  
  27.         if ( absint( $latest_news_category ) > 0 ) {
  28.             $qargs['cat'] = absint( $latest_news_category );
  29.         }
  30.  
  31.         // Fetch posts.
  32.         $the_query = new WP_Query( $qargs );
  33.         ?>
  34.  
  35.         <?php if ( $the_query->have_posts() ) : ?>
  36.             <div class="inner-wrapper latest-news-wrapper latest-news-col-<?php echo absint( $latest_news_column ); ?> latest-news-layout-<?php echo absint( $latest_news_layout ); ?>">
  37.                 <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
  38.                     <div class="latest-news-item">
  39.                         <div class="latest-news-inner-wrapper">
  40.                             <div class="latest-news-thumb">
  41.                                 <?php if ( has_post_thumbnail() ) : ?>
  42.                                     <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail( esc_attr( $latest_news_featured_image ), array( 'class' => 'aligncenter' ) ); ?></a>
  43.                                 <?php endif; ?>
  44.                                 <div class="read-more-button">
  45.                                     <a class="more" href="<?php the_permalink(); ?>"><?php esc_html_e( 'More', 'university-hub-pro' ); ?></a>
  46.                                 </div>
  47.                             </div><!-- .latest-news-thumb -->
  48.                             <div class="latest-news-text-wrap">
  49.                                 <h3 class="latest-news-title">
  50.                                     <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
  51.                                 </h3><!-- .latest-news-title -->
  52.                                 <div class="latest-news-meta">
  53.                                     <span class="posted-on"><a href="<?php the_permalink(); ?>"><?php the_time( _x( 'j M Y', 'date format', 'university-hub-pro' ) ); ?></a></span>
  54.                                     <?php university_hub_the_term_link_single( 'category', '<span class="cat-links">', '</span>' ); ?>
  55.                                     <?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
  56.                                         <span class="comments-link">
  57.                                             <?php comments_popup_link( esc_html__( '0 comments', 'university-hub-pro' ), esc_html__( '1 Comment', 'university-hub-pro' ), esc_html__( '% Comments', 'university-hub-pro' ) ); ?>
  58.                                         </span>
  59.                                     <?php endif; ?>
  60.                                 </div><!-- .latest-news-meta -->
  61.                                 <?php
  62.                                 $excerpt = university_hub_the_excerpt( absint( $latest_news_excerpt_length ) );
  63.                                 if ( $excerpt ) {
  64.                                     echo wp_kses_post( wpautop( $excerpt ) );
  65.                                 }
  66.                                 ?>
  67.                             </div><!-- .latest-news-text-wrap -->
  68.                         </div> <!-- .latest-news-inner-wrap -->
  69.                     </div><!-- .latest-news-item -->
  70.                 <?php endwhile; ?>
  71.             </div><!-- .latest-news-wrapper -->
  72.             <?php wp_reset_postdata(); ?>
  73.  
  74.         <?php endif; ?>
  75.     </div><!-- .container -->
  76. </div><!-- .home-section-team -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement