single-campus-life.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <?php
  2. /**
  3. * The template for displaying all single campus life posts
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
  6. *
  7. * @package UIU_DEPARTMENTAL
  8. */
  9. get_header(); ?>
  10. <?php while (have_posts()) : the_post(); ?>
  11. <main id="main" class="site-main" role="main">
  12. <section id="campus-life-banner">
  13. <div class="top-banner">
  14. <div class="uiu-banner-overlay"></div>
  15. <div class="bg-img" style="background-image: url(<?php echo get_the_post_thumbnail_url(); ?>)"></div>
  16. <div class="esential-links">
  17. <div class="container">
  18. <!-- breadcrumb -->
  19. <nav class="breadcrumb" aria-label="breadcrumb">
  20. <ul>
  21. <li><a href="<?php echo get_site_url(); ?>">Home</a></li>
  22. <li><a href="<?php echo get_site_url(); ?>/campus-life">Campus Life</a></li>
  23. </ul>
  24. </nav>
  25. <div class="links">
  26. <!-- message -->
  27. <a href="mailto:#">
  28. <img src="<?php echo (get_template_directory_uri()) ?>/img/envelope-solid - white.svg" alt="">
  29. </a>
  30. <!-- printer -->
  31. <a onclick="window.print()">
  32. <img src="<?php echo (get_template_directory_uri()) ?>/img/print-solid - white.svg" alt="">
  33. </a>
  34. <!-- facebook -->
  35. <a href="#">
  36. <img src="<?php echo (get_template_directory_uri()) ?>/img/facebook-f - white.svg" alt="">
  37. </a>
  38. <!-- twitter -->
  39. <a href="#">
  40. <img src="<?php echo (get_template_directory_uri()) ?>/img/twitter - white.svg" alt="">
  41. </a>
  42. <!-- linkedin -->
  43. <a href="#">
  44. <img src="<?php echo (get_template_directory_uri()) ?>/img/linkedin-in - white.svg" alt="">
  45. </a>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="container">
  51. <div class="content">
  52. <div class="publish-date">
  53. <span class="title">Publish Date : </span>
  54. <span class="date"><?php echo get_the_date(); ?></span>
  55. </div>
  56. <!-- main title -->
  57. <div class="main-title">
  58. <?php echo get_the_title(); ?>
  59. </div>
  60. <hr>
  61. </div>
  62. </div>
  63. </section>
  64. <div class="container">
  65. <section id="main-container">
  66. <!-- main component -->
  67. <div class="main-comp">
  68. <?php echo get_the_content(); ?>
  69. </div>
  70. </section>
  71. <section id="related-campus-life">
  72. <div class="section-title">
  73. Related Campus Life
  74. </div>
  75. <div class="items">
  76. <?php
  77. $post_cat_names = get_the_category(get_the_ID());
  78. $current_cat_name = $category_names[0]->slug;
  79. $args = array(
  80. 'post_type' => 'campus-life',
  81. 'posts_per_page' => 6,
  82. 'category_name' => $current_cat_name,
  83. 'post__not_in' => array(get_the_ID()),
  84. 'orderby' => 'date',
  85. 'order' => 'DESC',
  86. );
  87. $query = new WP_Query($args);
  88. if ($query->have_posts()) :
  89. while ($query->have_posts()) :
  90. $query->the_post(); ?>
  91. <div class="single-item">
  92. <div class="image-container">
  93. <img src="<?php echo get_the_post_thumbnail_url() ?>" alt="">
  94. </div>
  95. <a class="detail" href="<?php echo get_permalink(); ?>">
  96. <div class="date-container">
  97. <img class="icon" src="<?php echo (get_template_directory_uri()) ?>/img/calendar-days-regular.svg" alt="">
  98. <span class="date">
  99. <?php echo get_the_date(); ?>
  100. </span>
  101. </div>
  102. <div class="title">
  103. <?php echo get_the_title(); ?>
  104. </div>
  105. </a>
  106. </div>
  107. <?php
  108. endwhile;
  109. else :
  110. echo '<div class="no-post-found">No related posts has found! </div>';
  111. endif; ?>
  112. </div>
  113. </section>
  114. </div>
  115. </main>
  116. <?php endwhile; ?>
  117. <style>
  118. #campus-life-banner {
  119. padding: 3rem 0 3rem;
  120. }
  121. #campus-life-banner .uiu-banner-overlay {
  122. position: absolute;
  123. top: 0;
  124. left: 0;
  125. height: 100%;
  126. width: 100%;
  127. background-color: #0d2d62;
  128. opacity: 0.7;
  129. z-index: 1;
  130. background-image: linear-gradient(to right top, transparent 33%, #000 33%, #000 66%, transparent 66%);
  131. background-size: 3px 3px;
  132. background-repeat: repeat;
  133. }
  134. #campus-life-banner .top-banner {
  135. margin-bottom: 3rem;
  136. height: 60vh;
  137. max-height: 600px;
  138. position: relative;
  139. }
  140. #campus-life-banner .top-banner .bg-img {
  141. height: 100%;
  142. background-repeat: no-repeat;
  143. background-position: center;
  144. background-size: cover;
  145. }
  146. #campus-life-banner hr {
  147. margin-top: 1rem;
  148. border-color: #000;
  149. }
  150. #campus-life-banner .esential-links {
  151. position: absolute;
  152. bottom: 0;
  153. right: 0;
  154. left: 0;
  155. z-index: 2;
  156. padding: 0.75rem 0;
  157. }
  158. #campus-life-banner .esential-links .container {
  159. display: flex;
  160. justify-content: space-between;
  161. }
  162. #campus-life-banner .esential-links a {
  163. opacity: 1;
  164. }
  165. #campus-life-banner .breadcrumb {
  166. margin-top: 0 !important;
  167. z-index: 2;
  168. color: #fff !important;
  169. }
  170. #campus-life-banner .breadcrumb li {
  171. padding-top: 10px;
  172. padding-bottom: 10px;
  173. font-size: 0.8rem;
  174. }
  175. #campus-life-banner .breadcrumb li a {
  176. color: #fff;
  177. opacity: 1;
  178. font-weight: 500;
  179. }
  180. #campus-life-banner .breadcrumb li a::after {
  181. color: #fff;
  182. }
  183. #campus-life-banner .content {
  184. display: block;
  185. }
  186. #campus-life-banner .main-title {
  187. margin-top: 0.5rem;
  188. font-size: 1.7rem;
  189. font-weight: bold;
  190. letter-spacing: 2px;
  191. line-height: 1.4 !important;
  192. color: #333 !important;
  193. text-transform: capitalize;
  194. font-family: "DM Serif Text", serif;
  195. }
  196. #campus-life-banner .publish-date {
  197. margin-top: 0.75rem;
  198. font-size: 0.8rem;
  199. }
  200. #campus-life-banner .title {
  201. font-weight: bold;
  202. }
  203. #campus-life-banner .date {
  204. margin-left: 0.25rem;
  205. font-weight: 600;
  206. }
  207. #campus-life-banner .links {
  208. display: flex;
  209. gap: 1.5rem;
  210. }
  211. #campus-life-banner .links a {
  212. height: 1.2rem;
  213. }
  214. #campus-life-banner .links a:hover {
  215. transform: scale(1.2);
  216. opacity: 1 !important;
  217. }
  218. #campus-life-banner .links a img {
  219. height: 100%;
  220. }
  221. #campus-life-banner a {
  222. transition: all 0.25s ease-in-out;
  223. opacity: 0.65;
  224. text-decoration: none;
  225. }
  226. #main-container {
  227. margin: 0.5rem 0;
  228. display: block;
  229. font-family: "DM Serif Text", serif;
  230. }
  231. #main-container img {
  232. width: 100%;
  233. }
  234. #main-container .main-comp {
  235. padding: 0 0.75rem 1rem 0;
  236. }
  237. #main-container .main-comp .feature-image-holder {
  238. width: 100%;
  239. margin-bottom: 2rem;
  240. width: 100%;
  241. }
  242. #main-container .main-comp .campus-life {
  243. margin-top: 1rem;
  244. width: 100%;
  245. margin-bottom: 2rem;
  246. }
  247. #related-campus-life .section-title {
  248. color: rgb(0, 0, 0);
  249. font-weight: 600;
  250. font-size: 1.8rem;
  251. padding-bottom: 1rem;
  252. border-bottom: 1px solid #333;
  253. }
  254. #related-campus-life .items {
  255. margin-top: 2rem;
  256. display: flex;
  257. gap: 2rem;
  258. flex-wrap: wrap;
  259. }
  260. #related-campus-life .items .single-item {
  261. width: calc(33.3333% - 1.5rem);
  262. overflow: hidden;
  263. border-radius: 5px;
  264. box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2);
  265. }
  266. @media (max-width: 1000px) {
  267. #related-campus-life .items .single-item {
  268. width: calc(50% - 1.5rem);
  269. }
  270. }
  271. @media (max-width: 768px) {
  272. #related-campus-life .items .single-item {
  273. width: 100%;
  274. }
  275. }
  276. #related-campus-life .items .single-item .image-container {
  277. width: 100%;
  278. overflow: hidden;
  279. }
  280. #related-campus-life .items .single-item .image-container img {
  281. transition: 4s ease-in-out;
  282. }
  283. #related-campus-life .items .single-item:hover .image-container img {
  284. transform: scale(1.4);
  285. }
  286. #related-campus-life .items .single-item .detail {
  287. padding: 0.5rem 0.75rem 0.75rem;
  288. background-color: #fff;
  289. display: block;
  290. }
  291. #related-campus-life .items .single-item .detail:hover {
  292. opacity: unset;
  293. }
  294. #related-campus-life .items .single-item .detail .date-container {
  295. display: flex;
  296. gap: 0.5rem;
  297. align-items: center;
  298. justify-content: start;
  299. margin: 0.25rem 0 0.75rem;
  300. }
  301. #related-campus-life .items .single-item .detail .date-container .icon {
  302. height: 0.9rem;
  303. }
  304. #related-campus-life .items .single-item .detail .date-container .date {
  305. font-size: 0.7rem;
  306. font-weight: 700;
  307. }
  308. #related-campus-life .items .single-item .detail .title {
  309. font-size: 0.7rem;
  310. font-weight: 600;
  311. color: #0f465e;
  312. line-height: 1.7 !important;
  313. }
  314. @media print {
  315. head,
  316. header,
  317. footer {
  318. display: none;
  319. }
  320. main {
  321. padding-top: 0 !important;
  322. margin-top: 0 !important;
  323. }
  324. #archive-hero {
  325. margin: 0;
  326. }
  327. #notice-container {
  328. padding: 0;
  329. }
  330. }
  331. </style>
  332. <?php get_footer(); ?>