我不确定似乎是什么问题..我使用过get_template_directory();和bloginfo();正确..工作完美,因为他们..但问题是.. javascript不工作..我不确定是否必须添加get_template_directory_uri到每个JavaScript调用。任何帮助将不胜感激
header.php
<head>
<title>Blank</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='http://fonts.googleapis.com/css?family=Mr+De+Haviland|Yanone+Kaffeesatz:400,700|Open+Sans:400italic,400,700,600' rel='stylesheet' type='text/css' />
<!-- INLUDING STYLES -->
<link rel="stylesheet" type="text/css" href="<?php echo get_template_directory_uri(); ?>/css/bootstrap.min.css" media="screen" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url')?>" media="screen" />
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/js/poshytip-1.0/src/tip-twitter/tip-twitter.css" type="text/css" />
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/mosaic.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/css/prettyPhoto.css" type="text/css" media="screen" />
<?php wp_head(); ?>
</head>
<body>
<!-- TOP PART -->
<div id="banner-bg">
<div class="container">
<div class="logo">
<a href="index.html" title="Emporium"><a href="index.html" title="One Excelsia"><img src="<?php echo get_template_directory_uri(); ?>/img/OneExcelsiaFinal.png" alt="Unix Logo" name="logo" width="960" height="538" id="logo" class="img-responsive"/></a></a>
</div>
<!-- end logo -->
</div>
<!-- end container -->
</div>
<!-- end topContainer -->
<!-- MENNU -->
<div id="menuContainer">
<div class="container">
<div class="row">
<div id="mainmenu" class="col-md-6 col-xs-12">
<ul class="sf-menu hidden-xs">
<li><a href="index.html" id="visited">Home</a>
<ul>
<li><a href="index1.html">Piecemaker</a></li>
</ul>
</li>
<li><a href="about.html">About</a>
<ul>
<li><a href="services.html">Services</a></li>
</ul>
</li>
<li><a href="portfolio.html">Portfolio</a>
<ul>
<li><a href="portfolio.html">Portfolio Three Columns</a></li>
<li><a href="portfolio.html">Circle Portfolio</a></li>
<li><a href="portfolio.html">Project Detail Page</a></li>
<li><a href="gallery.html">Gallery</a></li>
</ul>
</li>
<li><a href="blog.html">Blog</a>
<ul>
<li><a href="singleblog.html">Single Blog Post</a></li>
</ul>
</li>
<li><a href="index.html">Features</a>
<ul>
<li><a href="index.html">Columns</a></li>
<li><a href="index.html">Price table</a></li>
</ul>
</li>
<li><a href="index.html">Contact</a></li>
</ul>
</div>
<!-- end mainmenu -->
<div id="socialsContainer" class="col-md-6 hidden-xs">
<div class="effect1 fl hidden-xs"> <a href="#" id="hovereffect1">Socialize</a> </div>
<ul class="socials fr">
<li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/socials/twitter.png" class="poshytip" title="Twitter" alt="" /></a></li>
<li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/socials/facebook.png" class="poshytip" title="Facebook" alt="" /></a></li>
<li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/socials/dribbble.png" class="poshytip" title="Dribbble" alt="" /></a></li>
<li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/socials/google%20plus.png" class="poshytip" title="Forrst" alt="" /></a></li>
<li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/socials/deviant.png" class="poshytip" title="Deviantart" alt="" /></a></li>
<li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/socials/deviant.png" class="poshytip" title="Kiko" alt="" /></a></li>
</ul>
</div>
<!-- end socials -->
<!-- end container -->
</div>
</div>
</div>
footer.php
<div class="blankSeparator2"><!-- --></div>
<!-- end bottomPart -->
<!-- end MAIN -->
<!-- FOOTER -->
<div id="footerContainer">
<div class="container">
<div id="footer" class="row">
<div class="col-md-4 col-xs-12">
<h3>One Excelsia </h3>
<p>Online Staffing & Internet Marketing</p>
<p>Executive Assistants, Internet Marketing Staff, Web Developers & Designers</p>
</div>
<!-- end onethird -->
<div class="col-md-4 col-xs-12">
<div id="flickrContainer">
<h3>Flickr Gallery</h3>
<ul class="list-unstyled">
<li><img src="img/flickr1.png" alt=""/> </li>
<li><img src="img/flickr2.png" alt=""/> </li>
<li><img src="img/flickr3.png" alt=""/> </li>
</ul>
</div>
<!-- end flickrContainer -->
</div>
<!-- end one-third -->
<div class="col-md-4 col-xs-12">
<div id="twitter">
<h3>Latest Tweets</h3>
<div id="tweets"></div>
</div>
<!-- end twitter -->
</div>
<!-- end one-third lastCol -->
</div>
<!-- end fotter -->
</div>
<!-- end container -->
</div>
<!-- end footerContainer -->
<!-- BOTTOM -->
<!-- Footer Copyright Container -->
<div id="footerCopyrightContainer">
<div class="container">
<p class="fl">© Copyright 2012 "Emporium" by <a href="http://www.anarieldesign.com/">Anariel Design</a>. All rights reserved.</p>
<a class="totop" href="#top"><img src="img/totop.png" class="poshytip" title="back to top" alt=""/></a> </div>
<!-- end container -->
</div>
<!-- end footerCopyrightContainer -->
<!-- END BOTTOM -->
<script src="js/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/holder.js"></script>
<!-- INLUDING SCRIPTS -->
<!-- Include jQuery -->
<!-- Include main functions -->
<script src="js/functions.js" type="text/javascript"></script>
<!-- Tooltip -->
<script type="text/javascript" src="js/poshytip-1.0/src/jquery.poshytip.min.js"></script>
<!-- Mosaic jQuery -->
<script type="text/javascript" src="js/mosaic.1.0.1.js"></script>
<!-- Tweets -->
<script type='text/javascript' src='js/jquery.tweetable.js'></script>
<!-- Lettering -->
<script type="text/javascript" src="js/jquery.lettering.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="js/jquery.hoverwords.js"></script>
<!-- Piecemaker -->
<script type="text/javascript" src='scripts/swfobject/swfobject.js'></script>
<!-- Nivo slider -->
<script src="js/jquery.nivo.slider.js" type="text/javascript"></script>
<!-- Include Superfish -->
<script src="js/superfish.js" type="text/javascript"></script>
<!-- Include prettyPhoto -->
<script src="js/jquery.prettyPhoto.js" type="text/javascript"></script>
<?php wp_footer(); ?>
</body>
</html>
答案 0 :(得分:0)
您的JavaScript文件未正确包含,应该是:
<script src="<?php echo get_template_directory_uri(); ?>/js/functions.js" type="text/javascript"></script>
像过去一样包含CSS文件。
包含CSS和JS文件的正确方法是,在functions.php文件中创建以下函数:
function include897_script_style(){
// For Styles
wp_enqueue_style( 'style-name',
get_template_directory_uri() . '/css/mosaic.css' );
// for Scripts
wp_enqueue_script( 'script-name',
get_template_directory_uri() . '/js/functions.js',
array(), '1.0.0', true );
}
add_action('wp_enqueue_scripts', 'include897_script_style');
有关详细信息,请查看wp_enqueue_script()