archive-news.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /**
  3. * The template for displaying news archive page
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  6. *
  7. * @package UIU_CSE
  8. */
  9. get_header();
  10. ?>
  11. <main id="primary" class="site-main">
  12. <div class="sections">
  13. <section id="all-news" class="container">
  14. <h2>All News</h2>
  15. <hr>
  16. <?php if (have_posts()) : ?>
  17. <?php while (have_posts()) : the_post(); ?>
  18. <div class="parent-grid">
  19. <div class="stub grid-sub-item">
  20. <div class="stub-img-holder">
  21. <img class="stub-img" src="<?php echo get_the_post_thumbnail_url() ?>" alt="">
  22. </div>
  23. <span class="news-date"><?php the_field('news_date'); ?></span>
  24. <a href="<?php echo get_permalink(); ?>">
  25. <h3><?php echo get_the_title(); ?></h3>
  26. </a>
  27. </div>
  28. </div>
  29. <?php endwhile; ?>
  30. <?php the_posts_navigation(); ?>
  31. <?php
  32. else :
  33. get_template_part('template-parts/content', 'none');
  34. endif;
  35. ?>
  36. </section>
  37. </div>
  38. </main><!-- #main -->
  39. <style>
  40. header {
  41. height: 100px !important;
  42. }
  43. #all-news {
  44. display: flex;
  45. flex-direction: column;
  46. }
  47. #all-news h2 {
  48. color: #000 !important;
  49. margin-top: 40px;
  50. margin-bottom: 20px;
  51. }
  52. #all-news .stub {
  53. margin: 30px auto;
  54. }
  55. #all-news .stub-img-holder {
  56. height: 200px;
  57. overflow: hidden;
  58. }
  59. #all-news .stub-img-holder img {
  60. height: 100%;
  61. width: 100%;
  62. -o-object-fit: cover;
  63. object-fit: cover;
  64. -o-object-position: center;
  65. object-position: center;
  66. }
  67. #all-news .news-date {
  68. display: block;
  69. color: #485680;
  70. font-weight: 800;
  71. font-size: 14px;
  72. margin: 10px 0px !important;
  73. }
  74. #all-news h3 {
  75. height: 50px;
  76. font-size: 18px;
  77. line-height: 22px;
  78. font-family: "Open Sans", sans-serif;
  79. color: #2F4858 !important;
  80. margin: 20px auto;
  81. }
  82. /*# sourceMappingURL=archive-news.css.map */
  83. </style>
  84. <?php
  85. get_footer();