Bladeren bron

Minor fix on home page

Md Mozahidur Rahman 1 jaar geleden
bovenliggende
commit
661178d0e5
1 gewijzigde bestanden met toevoegingen van 34 en 75 verwijderingen
  1. 34 75
      page-template/page-home.php

+ 34 - 75
page-template/page-home.php

@@ -204,7 +204,7 @@ get_header(); ?>
                                 <a class="faculty-name" href="<?php echo get_the_permalink(); ?>">
                                     <div class="faculty-details">
                                         <h2><?php echo $FullName; ?>
-                                            <!-- <span class="degree"><?php //if ($Title == "Dr.") {echo ', PhD';} 
+                                            <!-- <span class="degree"><?php //if ($Title == "Dr.") {echo ', PhD';}
                                                                         ?>
                                         </span> -->
                                         </h2>
@@ -408,9 +408,10 @@ get_header(); ?>
 
                 <div class="news-row">
 
-                    <div class="news-big-img">
+                    <!-- <div class="news-big-img">
                         <div class="news-big-img-holder">
-                            <img src="<?php echo (get_template_directory_uri()) ?>/img/campus_05.jpg" alt="">
+                            <img src="<?php //echo (get_template_directory_uri())
+                                        ?>/img/campus_05.jpg" alt="">
                         </div>
 
                         <div class="news-big-img-text">
@@ -421,80 +422,42 @@ get_header(); ?>
                             </a>
                         </div>
                     </div>
+-->
 
 
+                    <?php
+                    $args = array(
+                        'post_type'      => 'news',
+                        'posts_per_page' => 6,
+                        'post__not_in' => array(get_the_ID()),
+                        'orderby'        => 'date',
+                        'order'          => 'DESC',
+                    );
 
-                    <div class="news-small-img">
-                        <div class="news-sm-img-holder">
-                            <img src="<?php echo (get_template_directory_uri()) ?>/img/campus_05.jpg" alt="">
-                        </div>
-                        <div class="news-sm-img-text">
-                            <h5>28th March, 2016</h5>
-                            <h4> <a href=""> Seminar</a></h4>
-                            <a href="">
-                                <p>Development and Mining of a Volatile Compounds</p>
-                            </a>
-                        </div>
-                    </div>
-
-                    <div class="news-small-img">
-                        <div class="news-sm-img-holder">
-                            <img src="<?php echo (get_template_directory_uri()) ?>/img/campus_01.jpg" alt="">
-                        </div>
-                        <div class="news-sm-img-text">
-                            <h5>28th March, 2016</h5>
-                            <h4> <a href=""> Seminar</a></h4>
-                            <a href="">
-                                <p>Development and Mining of a Volatile Compounds</p>
-                            </a>
-                        </div>
-                    </div>
-
-
-
-
-                    <div class="news-small-img">
-                        <div class="news-sm-img-holder">
-                            <img src="<?php echo (get_template_directory_uri()) ?>/img/campus_05.jpg" alt="">
-                        </div>
-                        <div class="news-sm-img-text">
-                            <h5>28th March, 2016</h5>
-                            <h4> <a href=""> Seminar</a></h4>
-                            <a href="">
-                                <p>Development and Mining of a Volatile Compounds</p>
-                            </a>
-                        </div>
-                    </div>
-
-                    <div class="news-small-img">
-                        <div class="news-sm-img-holder">
-                            <img src="<?php echo (get_template_directory_uri()) ?>/img/campus_01.jpg" alt="">
-                        </div>
-                        <div class="news-sm-img-text">
-                            <h5>28th March, 2016</h5>
-                            <h4> <a href=""> Seminar</a></h4>
-                            <a href="">
-                                <p>Development and Mining of a Volatile Compounds</p>
-                            </a>
-                        </div>
-                    </div>
-
+                    $query = new WP_Query($args);
 
+                    if ($query->have_posts()) :
+                        while ($query->have_posts()) :
+                            $query->the_post(); ?>
+                            <div class="news-small-img">
+                                <div class="news-sm-img-holder">
+                                    <img src="<?php echo get_the_post_thumbnail_url() ?>" alt="">
+                                </div>
+                                <div class="news-sm-img-text">
+                                    <h5><?php the_field('news_date'); ?></h5>
+                                    <h4> <a href=""> Seminar</a></h4>
+                                    <a href="<?php echo get_permalink(); ?>">
+                                        <p><?php echo get_the_title(); ?></p>
+                                    </a>
+                                </div>
+                            </div>
 
-                    <div class="news-big-img">
-                        <div class="news-big-img-holder">
-                            <img src="<?php echo (get_template_directory_uri()) ?>/img/campus_05.jpg" alt="">
-                        </div>
-
-                        <div class="news-big-img-text">
-                            <h5>28th March, 2016</h5>
-                            <h4> <a href=""> Seminar</a></h4>
-                            <a href="">
-                                <p>Development and Mining of a Volatile Organic Compound Database</p>
-                            </a>
-                        </div>
-                    </div>
 
+                    <?php
+                        endwhile;
+                    else :
+                        echo '<div class="no-post-found">No related news has found! </div>';
+                    endif; ?>
                 </div>
 
                 <a href="/news/">
@@ -507,13 +470,9 @@ get_header(); ?>
             <div class="bg-tint">
 
                 <div class="container">
-
                     <h1>Upcoming Events</h1>
-
                     <div class="grid">
 
-
-
                         <?php
                         $args = array(
                             'post_type'      => 'event',