WordPress的永久链接 [英] wordpress permalinks

查看:110
本文介绍了WordPress的永久链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的wordpress永久链接结构设置为/%postname%/,但是现在当我转到主页以外的页面时(例如,如果我访问somelink.com/about),我将丢失所有的JavaScript参考.

I set my wordpress permalink structure to /%postname%/ but now when I go to a page other than the home page (for example if I went to somelink.com/about) I lose all javascript references.

我认为发生这种情况是因为到js文件的链接不再像在虚构的文件夹"about"中那样正确.这就是在header.php文件中引用js文件的方式.

I think this happens because the links to the js files are no longer right as it is in the imaginary folder "about". This is how the js files are referenced in the header.php file.

        <script type="text/javascript" src="wp-content/themes/default/js/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="wp-content/themes/default/js/cufon-yui.js"></script>
    <script type="text/javascript" src="wp-content/themes/default/js/Goudy_Bookletter_1911_400.font.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {      
            Cufon.replace('h1');
            Cufon.replace('h3', {textShadow:'0 1px #fff'});
        });
    </script>

我做错什么了吗?

推荐答案

如果您引用模板文件中的任何内容,则可以使用其中任何一个

if you are referencing anything in your template files you can use either

1:

<?php bloginfo('url');?>

或2:

<?php bloginfo('template_url');?>

,其编码为:

<script type="text/javascript" src="<?php bloginfo('url');?>/wp-content/themes/default/js/jquery-1.4.2.min.js"</script>

<script type="text/javascript" src="<?php bloginfo('template_url');?>/js/jquery-1.4.2.min.js"</script>

1:加载主站点URL; 2:会将绝对网址返回到您当前的主题目录,

1: loaded the main site URL; 2: will return the absolute url to your current themes directory,

(更适合主题开发).

这篇关于WordPress的永久链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆