wordpress permalinks

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.

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.

Read More
        <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>

Am I doing something wrong?

Related posts

Leave a Reply

2 comments

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

    1:

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

    or 2:

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

    which would be coded as:

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

    or

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

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

    (which is better for theme development).

  2. I gather you are manually inserting the javascript calls, which is not the best way to handle jQuery inclusion in WordPress – you should look into wp_enqueue_script, which will keep you from including the jquery libraries more than once if a plugin or theme you are using is also including them.

    Also, the ay you have the source written, I believe you are correct – the client is looking for the js files in the relative path under /about. Place a “/” before wp-content to have the client look for them inside wp-content within your root directory (assuming WP is installed at root).