-1
中调用我有一个大脚本在我的页脚底部硬编码。如何将脚本放入函数.php并在
HTML(footer.php)
<script>
jQuery(document).ready(function($){
// anchor scrolling/
function filterPath(string) {
return string
.replace(/^\//,'')
.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
.replace(/\/$/,'');
}
var locationPath = filterPath(location.pathname);
var scrollElem = scrollableElement('html', 'body');
...
</script>
</body>
</html>
我希望把它放在我的functions.php文件并调用它在这一点上,如果这是可能的/将它的工作。
可能重复[客户端和服务器端编程有什么区别?](http://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and - 服务器端编程) – Epodax
为什么你不创建一个.js文件,并将它包括在这里 –
我有其他的.js文件和函数文件等我只是想把它放在其中一个和计算的functions.php是最好的 – user3550879