我想在wordpress中加载两个js file only home(index.php)文件。但我不能
<?php if (is_page('home') ) { ?>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="<?php bloginfo('template_directory'); ?>/js/jcarousellite_1.0.1.js" type="text/javascript"></script>
<?php } ?>
我试过这个但不行。但没有家,如果我把其他页面名称,然后工作正常..实际上我的主页(index.php)。所以无论如何只能加载一个index.php或主页。我想我需要触发index.php页面不在家。我的主页不是由wordpress页面制作的。我索引。请看我的index.php文件代码。
<?php get_header(); ?>
<style type="text/css">
.sliderarea .sliderbg .sliderwrap .anyClass ul li {
background-color: #03F;
border: 2px solid #930;
height: 100px;
width: 100px;
margin-left: 10px;
}
</style>
<div class="slidshow">
<div class="sshow"><?php echo do_shortcode("[widgetkit id=741]"); ?> </div>
<div class="overshadow"></div>
<div class="righpanbox">
<ul>
<li><a href="<?php echo get_permalink(get_ID_by_slug('why-web')); ?>"><?php echo $images=get_the_post_thumbnail(get_ID_by_slug('why-gentaweb'));?> </a></li>
<li><img src="<?php bloginfo('template_directory'); ?>/images/star_sepa.png" /></a></li>
<li><a href="<?php echo get_permalink(get_ID_by_slug('why-web-domain-sale')); ?>"><?php echo $images=get_the_post_thumbnail(get_ID_by_slug('why-web-domain-sale'));?> </a></li>
<li><img src="<?php bloginfo('template_directory'); ?>/images/star_sepa.png" /></li>
</ul>
</div>
</div>
<div class="cls"></div>
<div class="sliderarea">
<div class="sliderbg">
<div class="sliderwrap">
<button class="prev"><<</button>
<button class="next">>></button>
<div class="anyClass">
<ul>
<li><img src="someimage" alt="" width="100" height="100" ></li>
<li><img src="someimage" alt="" width="100" height="100" ></li>
<li><img src="someimage" alt="" width="100" height="100" ></li>
<li><img src="someimage" alt="" width="100" height="100" ></li>
<li><img src="someimage" alt="" width="100" height="100" ></li>
<li><img src="someimage" alt="" width="100" height="100" ></li>
<li><img src="someimage" alt="" width="100" height="100" ></li>
<li><img src="someimage" alt="" width="100" height="100" ></li>
</ul>
</div>
<script>
$(function() {
$(".anyClass").jCarouselLite({
btnNext: ".next",
btnPrev: ".prev"
});
});
</script>
</div>
</div>
</div>
<?php get_footer(); ?>