ThemeShaper Forums » Thematic

[closed]

Remove thematic_head_scripts

(17 posts)
  • Started 5 years ago by Anthrax
  • Latest reply from perryb
  • This topic is resolved
  1. remove_action('wp_head','thematic_head_scripts'); is the first line in my functions.php but it won't remove this lines from the generated site.

    <script type="text/javascript" src="http://localhost/wordpress/wp-content/themes/thematic/library/scripts/hoverIntent.js"></script>
        <script type="text/javascript" src="http://localhost/wordpress/wp-content/themes/thematic/library/scripts/superfish.js"></script>
    
        <script type="text/javascript" src="http://localhost/wordpress/wp-content/themes/thematic/library/scripts/supersubs.js"></script>
        <script type="text/javascript" src="http://localhost/wordpress/wp-content/themes/thematic/library/scripts/thematic-dropdowns.js"></script>

    put i the remove_action directly at the scripts.php after add_action('wp_head','thematic_head_scripts'); it works.

    Whats going wrong?

    Posted 5 years ago #
  2. Hey Björn,

    try

    function remove_scripts() {
        remove_action('wp_head','thematic_head_scripts');
    }
    add_action('init', 'remove_scripts');

    Cheers,

    Chris

    Posted 5 years ago #
  3. Thx Chris, it works.
    But am i wrong to remove a action only with remove_action ?

    Posted 5 years ago #
  4. No .. normally .. hmmm .. Need to go into the details to explain it:

    Let's say you want to remove an action listed in a plugin then you can to this by a simple remove_action.

    In your case you need to wrap it into an action added to 'init' 'cause of the order WordPress loads several things: plugins, theme, template. Doing a simple remove_action on a action listed in the template (in our case Thematic) can't work, because it's not loaded at the time you execute the theme (functions.php). Dropping the remove_action into 'init' will wait until everything is loaded before executing the command.

    Cheers,

    Chris

    Posted 5 years ago #
  5. Some more details: init

    Posted 5 years ago #
  6. Thanx for the explanation.

    Cheers,
    Björn

    Posted 5 years ago #
  7. Thanks Chris,
    I was having the same problem trying to replace the thematic_access function. This fixed it!

    John

    Posted 5 years ago #
  8. Is there any way to get rid of the jQuery script in the header as well?

    Posted 4 years ago #
  9. Hi Mischif,

    Try:

    function remove_scripts() {
        if (!is_admin()) {
    	    wp_deregister_script('jquery');
    	}
    	remove_action('wp_head','thematic_head_scripts');
    }
    add_action('init', 'remove_scripts');

    -Gene

    Posted 4 years ago #
  10. Is there any reason why remove_scripts should work fine on a local install but not on a live site?

    Posted 2 years ago #
  11. PS: I really should have mentioned that I'm running 0.9.7.7 locally and 0.9.7.8 on my server (which I'm guessing may have something to do with it)

    Posted 2 years ago #
  12. @perryb - definitely upgrade both to 0.9.8
    http://developing.thematic4you.com/thematic-development-release/

    Posted 2 years ago #
  13. Cheers - any clue why I'm having the above problem:

    function remove_scripts() {
        remove_action('wp_head','thematic_head_scripts');
    }
    add_action('init', 'remove_scripts');

    Does the above snippet not work in the latest version?

    Posted 2 years ago #
  14. Apologies for bumping once more. Is the above code compatible with 0.9.7.8 or is something else causing it to not remove the scripts?

    Posted 2 years ago #
  15. Arrrgh! just read my version number again please ignore the above

    Posted 2 years ago #
  16. OK one last go.

    I finally installed the development version (9.8) on both the local dev version of my site and on the live host to make a direct comparison.

    Both sites are identical but the remove_scripts code above has no effect on the live site.

    What could be causing this?

    Posted 2 years ago #
  17. OK - it looks like WP-supercache might have been the culprit. I thought this might have been the case and tried disabling it but without any joy.

    Since tinkering last night the head scripts have finally disappeared from my source.

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.