single-news.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <?php
  2. /**
  3. * The template for displaying all single news posts
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
  6. *
  7. * @package UIU_CSE
  8. */
  9. get_header(); ?>
  10. <?php while (have_posts()) : the_post(); ?>
  11. <main id="main" class="site-main" role="main">
  12. <div class="sections">
  13. <section id="news-single-header" class="container">
  14. <h5>News</h5>
  15. <h1><?php echo get_the_title(); ?></h1>
  16. <p class="subtext">
  17. <?php echo get_the_excerpt(); ?>
  18. </p>
  19. <span class="news-date single"><?php the_field('news_date'); ?></span>
  20. <hr>
  21. <div class="news-socials">
  22. <div>
  23. SHARE:
  24. <a href="#" class="social-icons"><i class="fa-brands fa-facebook-f"></i></a>
  25. <a href="#" class="social-icons"><i class="fa-brands fa-twitter"></i></a>
  26. <a href="#" class="social-icons"><i class="fa-brands fa-linkedin-in"></i></a>
  27. </div>
  28. </div>
  29. </section>
  30. <section id="news-single-header" class="container">
  31. <div class="news-single-body">
  32. <span class="author"> By <?php echo get_the_author_meta('display_name'); ?></span>
  33. <div class="article-cover-image">
  34. <img src="<?php echo get_the_post_thumbnail_url(); ?>" alt="">
  35. <span class="img-caption"> </span>
  36. </div>
  37. <div class="article">
  38. <?php echo get_the_content(); ?>
  39. </div>
  40. <hr>
  41. </div>
  42. </section>
  43. <section id="more-news" class="container">
  44. <h2>In Other News</h2>
  45. <div class="parent-grid">
  46. <?php
  47. $args = array(
  48. 'post_type' => 'news',
  49. 'posts_per_page' => 6,
  50. 'post__not_in' => array(get_the_ID()),
  51. 'orderby' => 'date',
  52. 'order' => 'DESC',
  53. );
  54. $query = new WP_Query($args);
  55. if ($query->have_posts()) :
  56. while ($query->have_posts()) :
  57. $query->the_post(); ?>
  58. <div class="stub grid-sub-item">
  59. <div class="stub-img-holder">
  60. <img class="stub-img" src="<?php echo get_the_post_thumbnail_url() ?>" alt="">
  61. </div>
  62. <span class="news-date"><?php the_field('news_date'); ?></span>
  63. <a href="<?php echo get_permalink(); ?>">
  64. <h3><?php echo get_the_title(); ?></h3>
  65. </a>
  66. </div>
  67. <?php
  68. endwhile;
  69. else :
  70. echo '<div class="no-post-found">No related news has found! </div>';
  71. endif; ?>
  72. </div>
  73. </section>
  74. </div>
  75. </main>
  76. <?php endwhile; ?>
  77. <style>
  78. p {
  79. max-width: 100% !important;
  80. }
  81. header {
  82. height: 100px !important;
  83. }
  84. #news-single-header h5 {
  85. margin-top: 30px;
  86. font-size: 30px;
  87. }
  88. #news-single-header h1 {
  89. color: #000 !important;
  90. font-family: "DM Serif Text", serif;
  91. }
  92. #news-single-header h5 {
  93. color: #2F4858;
  94. font-size: 34px;
  95. }
  96. #news-single-header .subtext {
  97. font-size: 22px !important;
  98. color: #2F4858 !important;
  99. }
  100. #news-single-header .news-date {
  101. display: block;
  102. color: #485680;
  103. font-weight: 800;
  104. font-size: 14px;
  105. }
  106. .news-socials {
  107. margin: 20px 20px !important;
  108. font-size: 26x;
  109. }
  110. .news-socials a {
  111. margin: 0px 15px;
  112. }
  113. .social-icons {
  114. color: #2F4858;
  115. }
  116. .news-single-body {
  117. max-width: 900px !important;
  118. margin: 30px auto !important;
  119. }
  120. .news-single-body p {
  121. font-size: 18px;
  122. color: #2F4858 !important;
  123. }
  124. .news-single-body h3 {
  125. font-family: "DM Serif Text", serif;
  126. font-size: 26px;
  127. color: #2F4858;
  128. }
  129. .news-single-body .author {
  130. display: block;
  131. color: rgba(0, 0, 0, 0.6431372549);
  132. margin: 20px auto !important;
  133. }
  134. .img-caption {
  135. font-size: 14px;
  136. color: #475481 !important;
  137. line-height: 14px;
  138. }
  139. #more-news {
  140. display: flex;
  141. flex-direction: column;
  142. }
  143. #more-news h2 {
  144. color: #000 !important;
  145. width: 100%;
  146. text-align: center;
  147. }
  148. #more-news .stub {
  149. margin: 30px auto;
  150. }
  151. #more-news .stub-img-holder {
  152. height: 300px;
  153. overflow: hidden;
  154. }
  155. #more-news .stub-img-holder img {
  156. height: 100%;
  157. width: 100%;
  158. -o-object-fit: cover;
  159. object-fit: cover;
  160. -o-object-position: center;
  161. object-position: center;
  162. }
  163. #more-news .news-date {
  164. display: block;
  165. color: #485680;
  166. font-weight: 800;
  167. font-size: 14px;
  168. margin: 10px 0px !important;
  169. }
  170. #more-news h3 {
  171. height: 50px;
  172. font-size: 18px;
  173. line-height: 22px;
  174. font-family: "Open Sans", sans-serif;
  175. color: #2F4858 !important;
  176. margin: 20px auto;
  177. }
  178. /*# sourceMappingURL=single-news.css.map */
  179. </style>
  180. <?php get_footer(); ?>