如何在wordpress index.php文件中添加滑块?
我的滑块javascript代码如下所示,显示在 html格式,但在我将其集成到主题中时未显示。此代码位于header.php中。我已在其中调用了所有需要的js css和图像文件,效果良好,但问题出在滑块部分如何在wordpress index.php文件中添加滑块?,php,jquery,wordpress,Php,Jquery,Wordpress,我的滑块javascript代码如下所示,显示在 html格式,但在我将其集成到主题中时未显示。此代码位于header.php中。我已在其中调用了所有需要的js css和图像文件,效果良好,但问题出在滑块部分 Code in header.php <script type="text/javascript"> $(window).load(function() { $('.flexslider').flexslider({ animation: "sl
Code in header.php
<script type="text/javascript">
$(window).load(function() {
$('.flexslider').flexslider({
animation: "slide",
useCSS: Modernizr.touch
});
});
</script>
Code in index.php
<div class="flexslider">
<ul class="slides">
<li>
<div class="hero-unit">
<h1>Affordable Hosting Solution</h1>
<h3>Flathost is a bootstrap based responsive minimal, flat and afforable
hosting template with easy customization and great support</h3>
<div class="slider-actions text-center"> <a href="features.html" class="btn
btn-success btn-lg">Explore Features </a> <a href="pricing.html" class="btn
btn-primary btn-lg">Plans and Pricing </a> </div>
</div>
</li>
<li>
<div class="slide2">
<p><img src="<?php echo get_template_directory_uri(); ?
>/images/server1.png" alt="server" class="img-responsive center-block"></p>
<h1>Dedicated and VIP Hosting</h1>
</div>
</li>
<li>
<div class="slide3">
<p class="pull-left"><img src="<?php echo get_template_directory_uri(); ?
>/images/server2.png" alt="server" class="img-responsive"></p>
<h1>Managed Hosting</h1>
<h3>Flathost is a bootstrap based responsive minimal, flat and afforable
hosting template with easy customization and great support </h3>
</div>
</li>
</ul>
</div>
</div>
</div>
<?php echo do_shortcode('[thethe-image-slider name="flexslider"]'); ?>
header.php中的代码
$(窗口)。加载(函数(){
$('.flexslider').flexslider({
动画:“幻灯片”,
useCSS:modernizer.touch
});
});
index.php中的代码
- 负担得起的托管解决方案 Flathost是一款基于引导的响应性极低、平坦且和蔼可亲的产品 托管模板,易于定制和强大的支持
- /images/server1.png“alt=“server”class=“img响应中心块”> 专用和VIP托管
-
/images/server2.png“alt=“server”class=“img responsive”>
管理托管 Flathost是一款基于引导的响应性极低、平坦且和蔼可亲的产品 托管模板,易于定制和强大的支持
它正在显示图像吗?滑块中没有图像也不会显示。您是否检查了Firebug或inspect elements正在检索哪些路径图像?检查一下。