Forums

Easy Digital Downloads
[resolved] CSS & JS files not referenced (7 posts)

  1. stitchyrocks
    Member
    Posted 9 months ago #

    Hi,

    I just noticed that the CSS & JS files for this plugin (and all my other plugins) are not being referenced anywhere. I manually added the CSS to my theme's styles.css file for now, but I'm wondering what could be causing this issue. If you look in the head of my site, it only shows the css & js files that I'm already referencing, but nothing from edd or any of my other plugins.

    Here's the site:
    http://www.billcurreri.com/

    http://wordpress.org/extend/plugins/easy-digital-downloads/

  2. mordauk
    Pippin's Plugins
    Plugin Author

    Posted 9 months ago #

    How are you referencing your CSS and JS? It sounds like your theme is missing the wp_head() and wp_footer() components.

  3. stitchyrocks
    Member
    Posted 9 months ago #

    Hmm. Ok. I accidentally deleted wp_head() from header.php (but I did have the footer although that didn't have any js references). I have since moved all of my own js references to the footer.

    Anyway, I'm noticing something weird. The header is pointing to a jquery file that's on my server (which I'm assuming is triggered by something in one of my plugins. I also included a jquery file (same version) but one that is using the link from Google (in the footer). When I take out the one from Google in the footer, however, it seems like jQuery is not working at all. I think this redundancy is causing some problems in EDD and my other plug-ins. Do you know why? And how do I remedy this?

    Thanks so much for your tiem.

  4. mordauk
    Pippin's Plugins
    Plugin Author

    Posted 9 months ago #

    Can you show me how you are loading your JS? It sounds like there is a JS conflict.

    Make sure that you add wp_head() back in.

    It's also really not advisable that you load jQuery from Google, as it can cause a lot of unforseen problems.

  5. stitchyrocks
    Member
    Posted 9 months ago #

    Now I'm loading it in functions.php per instructions from this page:

    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    Using this snippet:

    <?php
    function my_scripts_method() {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
        wp_enqueue_script( 'jquery' );
    }    
    
    add_action('wp_enqueue_scripts', 'my_scripts_method');
    ?>

    Is that ok?

  6. mordauk
    Pippin's Plugins
    Plugin Author

    Posted 9 months ago #

    It's okay, though I'd still not advise it. This is best:

    function my_scripts_method() {
        wp_enqueue_script( 'jquery' );
    }    
    
    add_action('wp_enqueue_scripts', 'my_scripts_method');
  7. stitchyrocks
    Member
    Posted 9 months ago #

    Gotcha. Thanks much!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.