page-archive-news.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <?php
  2. /**
  3. * The template for displaying news archive page
  4. *
  5. * Template Name: Archive - News
  6. *
  7. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  8. *
  9. * @package UIU_DEPARTMENTAL
  10. */
  11. get_header();
  12. ?>
  13. <main id="primary" class="site-main">
  14. <section id="archive-hero">
  15. <div class="container">
  16. <!-- breadcrumb -->
  17. <nav aria-label="breadcrumb">
  18. <ul>
  19. <li><a href="/">Home</a></li>
  20. <li>News</li>
  21. </ul>
  22. </nav>
  23. <div class="content">
  24. <!-- left content -->
  25. <div class="left-content">
  26. <div class="main-title">News</div>
  27. <div class="short-details">
  28. Here you will have access to all United International University News.
  29. </div>
  30. <div class="links">
  31. <!-- message -->
  32. <a href="#">
  33. <img src="<?php echo (get_template_directory_uri()) ?>/img/envelope-solid.svg" alt="">
  34. </a>
  35. <!-- printer -->
  36. <a href="#">
  37. <img src="<?php echo (get_template_directory_uri()) ?>/img/print-solid.svg" alt="">
  38. </a>
  39. <!-- facebook -->
  40. <a href="#">
  41. <img src="<?php echo (get_template_directory_uri()) ?>/img/facebook-f.svg" alt="">
  42. </a>
  43. <!-- twitter -->
  44. <a href="#">
  45. <img src="<?php echo (get_template_directory_uri()) ?>/img/twitter.svg" alt="">
  46. </a>
  47. <!-- linkedin -->
  48. <a href="#">
  49. <img src="<?php echo (get_template_directory_uri()) ?>/img/linkedin-in.svg" alt="">
  50. </a>
  51. </div>
  52. </div>
  53. <!-- right content -->
  54. <div class="right-content">
  55. <img src="<?php echo (get_template_directory_uri()) ?>/img/campus_07.jpg" alt="">
  56. </div>
  57. </div>
  58. </div>
  59. </section>
  60. <div class="sections">
  61. <section id="all-news" class="container">
  62. <div class="parent-grid">
  63. <?php
  64. $args = array(
  65. 'post_type' => 'news',
  66. 'meta_query' => array(
  67. 'relation' => 'OR',
  68. array(
  69. 'key' => 'related_institutes',
  70. 'value' => 'BBA',
  71. 'compare' => 'LIKE'
  72. ),
  73. array(
  74. 'key' => 'related_institutes',
  75. 'value' => 'sobe',
  76. 'compare' => 'LIKE'
  77. ),
  78. array(
  79. 'key' => 'related_institutes',
  80. 'value' => 'all_departments',
  81. 'compare' => 'LIKE'
  82. ),
  83. array(
  84. 'key' => 'related_institutes',
  85. 'value' => 'all_sites',
  86. 'compare' => 'LIKE'
  87. )
  88. ),
  89. 'posts_per_page' => 6,
  90. 'orderby' => 'date',
  91. 'order' => 'DESC',
  92. );
  93. $query = new WP_Query($args);
  94. if ($query->have_posts()) :
  95. while ($query->have_posts()) :
  96. $query->the_post(); ?>
  97. <div class="stub grid-sub-item">
  98. <div class="stub-img-holder">
  99. <img class="stub-img" src="<?php echo get_the_post_thumbnail_url() ?>" alt="">
  100. </div>
  101. <span class="news-date"><?php the_field('news_date'); ?></span>
  102. <a href="<?php echo get_permalink(); ?>">
  103. <h3><?php echo get_the_title(); ?></h3>
  104. </a>
  105. </div>
  106. <?php endwhile; ?>
  107. <?php the_posts_navigation(); ?>
  108. <?php
  109. else :
  110. get_template_part('template-parts/content', 'none');
  111. endif;
  112. ?>
  113. </div>
  114. </section>
  115. </div>
  116. </main><!-- #main -->
  117. <style>
  118. header {
  119. height: 100px !important;
  120. }
  121. #all-news {
  122. display: flex;
  123. flex-direction: column;
  124. }
  125. #all-news h2 {
  126. color: #000 !important;
  127. margin-top: 40px;
  128. margin-bottom: 20px;
  129. }
  130. #all-news .stub {
  131. margin: 30px auto;
  132. }
  133. #all-news .stub-img-holder {
  134. height: 200px;
  135. overflow: hidden;
  136. }
  137. #all-news .stub-img-holder img {
  138. height: 100%;
  139. width: 100%;
  140. -o-object-fit: cover;
  141. object-fit: cover;
  142. -o-object-position: center;
  143. object-position: center;
  144. }
  145. #all-news .news-date {
  146. display: block;
  147. color: #485680;
  148. font-weight: 800;
  149. font-size: 14px;
  150. margin: 10px 0px !important;
  151. }
  152. #all-news h3 {
  153. height: 50px;
  154. font-size: 18px;
  155. line-height: 22px;
  156. font-family: "Open Sans", sans-serif;
  157. color: #2F4858 !important;
  158. margin: 20px auto;
  159. }
  160. /*# sourceMappingURL=archive-news.css.map */
  161. </style>
  162. <?php
  163. get_footer();