Преглед изворни кода

Working with slider sortcode

Md Mozahidur Rahman пре 1 година
родитељ
комит
9e03545e52
1 измењених фајлова са 34 додато и 42 уклоњено
  1. 34 42
      page-template/page-home.php

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

@@ -25,48 +25,40 @@ get_header(); ?>
 
         <ul data-slides>
 
-            <li class="slide" data-active>
-                <div class="slider-single-div">
-                    <img src="<?php echo (get_template_directory_uri()) ?>/img/campus_01.jpg" alt="">
-                    <div class="banner-overlay">
-                        <h4>Welcome to </h4>
-                        <h1>United<br> International<br> University</h1>
-                        <h3>
-                            Department of <br>
-                            Computer Science &amp; Engineering
-                        </h3>
-                    </div>
-                </div>
-            </li>
-
-
-            <li class="slide">
-                <div class="slider-single-div">
-                    <img src="<?php echo (get_template_directory_uri()) ?>/img/Slider_Swan2.jpg" alt="">
-                    <div class="banner-overlay">
-                        <h4>Welcome to </h4>
-                        <h1>United International University</h1>
-                        <h3>
-                            Department of <br>
-                            Computer Science &amp; Engineering
-                        </h3>
-                    </div>
-                </div>
-            </li>
-
-
-            <li class="slide">
-                <div class="slider-single-div">
-                    <img src="<?php echo (get_template_directory_uri()) ?>/img/campus_02.jpg" alt="">
-                    <div class="banner-overlay">
-                        <h4>Welcome to </h4>
-                        <h1>Department of <br>
-                            Computer Science &amp; Engineering</h1>
-                        United International University
-                        </h3>
-                    </div>
-                </div>
-            </li>
+            <?php
+            $args = array(
+                'post_type'      => 'faculty',
+                'posts_per_page' => 10,
+                //'post__not_in' => array(get_the_ID()),
+                'orderby'        => 'date',
+                'order'          => 'DESC',
+            );
+
+            $query = new WP_Query($args);
+
+            if ($query->have_posts()) :
+                while ($query->have_posts()) :
+                    $query->the_post(); ?>
+                    <li class="slide" data-active>
+                        <div class="slider-single-div">
+                            <img src="<?php echo (get_template_directory_uri()) ?>/img/campus_01.jpg" alt="">
+                            <div class="banner-overlay">
+                                <h4>Welcome to </h4>
+                                <h1>United<br> International<br> University</h1>
+                                <h3>
+                                    Department of <br>
+                                    Computer Science &amp; Engineering
+                                </h3>
+                            </div>
+                        </div>
+                    </li>
+
+            <?php
+                endwhile;
+            else :
+                echo '<div class="no-post-found">No faculty profile has found! </div>';
+            endif; ?>
+
         </ul>
     </div>
 </section>