Prechádzať zdrojové kódy

slider is working now

Md Mozahidur Rahman 1 rok pred
rodič
commit
fc65518765
3 zmenil súbory, kde vykonal 103 pridanie a 80 odobranie
  1. 1 1
      functions.php
  2. 86 59
      inc/shortcodes.php
  3. 16 20
      page-template/page-home.php

+ 1 - 1
functions.php

@@ -222,7 +222,7 @@ include_once(get_stylesheet_directory() . '/inc/custom-post-type.php');
 include_once(get_stylesheet_directory() . '/inc/theme-settings.php');
 
 // Shortcodes
-// include_once( get_stylesheet_directory() . '/inc/shortcodes.php' );
+include_once(get_stylesheet_directory() . '/inc/shortcodes.php');
 
 
 // Fetch vimeo thumbnail on save - takes video ID as input

+ 86 - 59
inc/shortcodes.php

@@ -7,62 +7,89 @@
  */
 function build_home_slider($atts, $content = null)
 {
-
-	ob_start();
-
-	echo '<div class="members-logo row"> <div id="logo-slider" class="owl-carousel">';
-
-	if (have_rows('members_logo', 'option')) :
-		while (have_rows('members_logo', 'option')) : the_row();
-			$logo_url = get_sub_field('logo');
-			$company_link = get_sub_field('link');
-
-			echo '<div class="thumbnail thumbnail-hover">';
-			echo '<img class="img-responsive" src=" ' . $logo_url . '">';
-			echo '<a href=" ' . $company_link . ' " " title=" ' .  $company_link . ' " class="link-full"></a>';
-			echo '</div>';
-
-		endwhile;
-	else :
-		echo '<div class="col-xs-12">Members Logo Slider not found! <be> please add some logo in theme setting page</div>';
-	endif;
-	echo '</div></div>';
-
-	$output = ob_get_clean();
-	return $output;
-}
-
-add_shortcode('home_slider', 'build_home_slider');
-
-
-/**
- * Shortcode: Member logo slider
- */
-function member_logo_slider($atts, $content = null)
-{
-
-	ob_start();
-
-	echo '<div class="members-logo row"> <div id="logo-slider" class="owl-carousel">';
-
-	if (have_rows('members_logo', 'option')) :
-		while (have_rows('members_logo', 'option')) : the_row();
-			$logo_url = get_sub_field('logo');
-			$company_link = get_sub_field('link');
-
-			echo '<div class="thumbnail thumbnail-hover">';
-			echo '<img class="img-responsive" src=" ' . $logo_url . '">';
-			echo '<a href=" ' . $company_link . ' " " title=" ' .  $company_link . ' " class="link-full"></a>';
-			echo '</div>';
-
-		endwhile;
-	else :
-		echo '<div class="col-xs-12">Members Logo Slider not found! <be> please add some logo in theme setting page</div>';
-	endif;
-	echo '</div></div>';
-
-	$output = ob_get_clean();
-	return $output;
-}
-
-add_shortcode('members_logo', 'member_logo_slider');
+	ob_start(); ?>
+
+	<div class="banner-slider" data-banner-slider>
+		<button class="banner-slider-button prev" data-banner-slider-button="prev">
+			<span class="material-symbols-outlined">
+				arrow_back_ios
+			</span>
+		</button>
+		<button class="banner-slider-button next" data-banner-slider-button="next">
+			<span class="material-symbols-outlined">
+				arrow_forward_ios
+			</span>
+		</button>
+
+		<ul data-slides>
+			<?php
+
+			$i = 0;
+			if (have_rows('home_slider_slides', 'option')) :
+				while (have_rows('home_slider_slides', 'option')) : the_row();
+					$bg_image = get_sub_field('bg_image');
+					$sub_heading = get_sub_field('sub_heading');
+					$heading_main = get_sub_field('heading_main');
+					$text = get_sub_field('text');
+			?>
+					<li class="slide" <?php if ($i == 0) {
+											echo 'data-active';
+										} ?>>
+						<div class="slider-single-div">
+							<img src="<?php echo $bg_image  ?>" 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
+					$i = $i + 1;
+				endwhile;
+			else :
+				echo '<div class="col-xs-12">Members Logo Slider not found! <be> please add some logo in theme setting page</div>';
+			endif;
+			echo '</ul></div>';
+
+			$output = ob_get_clean();
+			return $output;
+		}
+
+		add_shortcode('home_slider', 'build_home_slider');
+
+
+		/**
+		 * Shortcode: Member logo slider
+		 */
+		function member_logo_slider($atts, $content = null)
+		{
+
+			ob_start();
+
+			echo '<div class="members-logo row"> <div id="logo-slider" class="owl-carousel">';
+
+			if (have_rows('members_logo', 'option')) :
+				while (have_rows('members_logo', 'option')) : the_row();
+					$logo_url = get_sub_field('logo');
+					$company_link = get_sub_field('link');
+
+					echo '<div class="thumbnail thumbnail-hover">';
+					echo '<img class="img-responsive" src=" ' . $logo_url . '">';
+					echo '<a href=" ' . $company_link . ' " " title=" ' .  $company_link . ' " class="link-full"></a>';
+					echo '</div>';
+
+				endwhile;
+			else :
+				echo '<div class="col-xs-12">Members Logo Slider not found! <be> please add some logo in theme setting page</div>';
+			endif;
+			echo '</div></div>';
+
+			$output = ob_get_clean();
+			return $output;
+		}
+
+		add_shortcode('members_logo', 'member_logo_slider');

+ 16 - 20
page-template/page-home.php

@@ -26,34 +26,30 @@ get_header(); ?>
         <ul data-slides>
 
             <?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>
+            $i = 0;
+            if (have_rows('home_slider_slides', 'option')) :
+                while (have_rows('home_slider_slides', 'option')) : the_row();
+                    $bg_image = get_sub_field('bg_image');
+                    $sub_heading = get_sub_field('sub_heading');
+                    $heading_main = get_sub_field('heading_main');
+                    $text = get_sub_field('text'); ?>
+
+                    <li class="slide" <?php if ($i == 0) {
+                                            echo 'data-active';
+                                        } ?>>
                         <div class="slider-single-div">
-                            <img src="<?php echo (get_template_directory_uri()) ?>/img/campus_01.jpg" alt="">
+                            <img src="<?php echo $bg_image  ?>" alt="">
                             <div class="banner-overlay">
-                                <h4>Welcome to </h4>
-                                <h1>United<br> International<br> University</h1>
+                                <h4><?php echo $sub_heading  ?></h4>
+                                <h1><?php echo $heading_main  ?></h1>
                                 <h3>
-                                    Department of <br>
-                                    Computer Science &amp; Engineering
+                                    <?php echo $text  ?>
                                 </h3>
                             </div>
                         </div>
                     </li>
-
             <?php
+                    $i = $i + 1;
                 endwhile;
             else :
                 echo '<div class="no-post-found">No faculty profile has found! </div>';