single-news.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. #news-single-header h5 {
  79. margin-top: 30px;
  80. font-size: 30px;
  81. }
  82. #news-single-header h1 {
  83. color: #000 !important;
  84. font-family: "DM Serif Text", serif;
  85. }
  86. #news-single-header h5 {
  87. color: #2F4858;
  88. font-size: 34px;
  89. }
  90. #news-single-header .subtext {
  91. font-size: 22px !important;
  92. color: #2F4858 !important;
  93. }
  94. #news-single-header .news-date {
  95. display: block;
  96. color: #485680;
  97. font-weight: 800;
  98. font-size: 14px;
  99. }
  100. .news-socials {
  101. margin: 20px 20px !important;
  102. font-size: 26x;
  103. }
  104. .news-socials a {
  105. margin: 0px 15px;
  106. }
  107. .social-icons {
  108. color: #2F4858;
  109. }
  110. .news-single-body {
  111. max-width: 900px !important;
  112. margin: 30px auto !important;
  113. }
  114. .news-single-body p {
  115. font-size: 18px;
  116. color: #2F4858 !important;
  117. }
  118. .news-single-body h3 {
  119. font-family: "DM Serif Text", serif;
  120. font-size: 26px;
  121. color: #2F4858;
  122. }
  123. .news-single-body .author {
  124. display: block;
  125. color: rgba(0, 0, 0, 0.6431372549);
  126. margin: 20px auto !important;
  127. }
  128. .img-caption {
  129. font-size: 14px;
  130. color: #475481 !important;
  131. line-height: 14px;
  132. }
  133. #more-news {
  134. display: flex;
  135. flex-direction: column;
  136. }
  137. #more-news h2 {
  138. color: #000 !important;
  139. width: 100%;
  140. text-align: center;
  141. }
  142. #more-news .stub {
  143. margin: 30px auto;
  144. }
  145. #more-news .stub-img-holder {
  146. height: 300px;
  147. overflow: hidden;
  148. }
  149. #more-news .stub-img-holder img {
  150. height: 100%;
  151. width: 100%;
  152. -o-object-fit: cover;
  153. object-fit: cover;
  154. -o-object-position: center;
  155. object-position: center;
  156. }
  157. #more-news .news-date {
  158. display: block;
  159. color: #485680;
  160. font-weight: 800;
  161. font-size: 14px;
  162. margin: 10px 0px !important;
  163. }
  164. #more-news h3 {
  165. height: 50px;
  166. font-size: 18px;
  167. line-height: 22px;
  168. font-family: "Open Sans", sans-serif;
  169. color: #2F4858 !important;
  170. margin: 20px auto;
  171. }
  172. /*# sourceMappingURL=single-news.css.map */
  173. </style>
  174. <?php get_footer(); ?>