0

I'm customizing a WP theme but I cannot remove one JS which I don't need. I have deleted it from the folder but it still renders in html.

There are 5 JQuery files in theme's js folder + one called base.js which seems to handle some objects but it has nothing to do with the JS I don't want to include.

So rendered html looks like this:

<script type='text/javascript' src='../wordpress/wp-content/themes/custom-theme/js/jquery.prettyPhoto.js?ver=3.7'></script>
<script type='text/javascript' src='../wordpress/wp-content/themes/custom-theme/js/jquery.fitvids.js?ver=3.7'></script>
<script type='text/javascript' src='../wordpress/wp-content/themes/custom-theme/js/jquery.innerfade.js?ver=3.7'></script>
<script type='text/javascript' src='../wordpress/wp-content/themes/custom-theme/js/jquery.backstretch.min.js?ver=3.7'></script>
<script type='text/javascript' src='../wordpress/wp-content/themes/custom-theme/js/base.js?ver=3.7'></script>
<script type='text/javascript' src='../wordpress/wp-content/themes/custom-theme/js/jquery.flexslider-min.js?ver=3.7'></script>

and I don't need the last one - FlexSlider for I'll be using a different one

There's an inline JS that also renders in html, and I want to remove it as well - I've opened each and every file in the theme folder and I couldn't find this piece of code anywhere

<!-- Flex Slider -->
<script type = "text/javascript"> 
jQuery(window).load(function () {
    // Slider
    jQuery('#slider').flexslider({
        animation: "fade",
        slideDirection: "horizontal",
        slideshow: true,
        slideshowSpeed: 7000,
        animationDuration: 600,
        directionNav: true,
        keyboardNav: true,
        randomize: false,
        pauseOnAction: true,
        pauseOnHover: false,
        controlsContainer: ".slideshow",
        animationLoop: true
    });
});
</script>

Any ideas on how I can prevent this JS from rendering and add a different one.

Thank you!

1
  • I have the same issue with metaslider.. Have you found where it comes from ?? Commented Feb 10, 2014 at 14:01

2 Answers 2

3

You will need to find where those files are being included. Generally, with Wordpress, the JS files are included from the address of the plugin folder. So it's strange that they're being included from your base JS folder.

I'm not sure why this would be happening. But you will need to find where these files are being called from and delete that code.

Considering the names of the JS files, I would search within the relative plugin folder for each file. E.G. Look in the pretty Photo plugin folder for the line that includes that JS file.

This will be tedious, but you don't want those files being called if they don't exist. This hurts load times.

Sign up to request clarification or add additional context in comments.

3 Comments

They are included in header.php file via <?php wp_enqueue_script("jquery"); ?> <?php wp_head(); ?>
Like I've said - I've opened each and every .php and .js file I've found and I could not find that piece of code anywhere. And if I delete <?php wp_enqueue_script("jquery"); ?> then nothing executes.
Well I meant included to be included in the header. Which sounds confusing. But the way Wordpress works is the line <?php wp_head(); ?> allows other plugins to include code. So somewhere else in a php file, there's a line like wp_register_script(...). This causes the JS file to be loaded in the header. You would need to find that line for each file. It's tough though. Beyond that, I'm not sure I can help. Try posting on the Wordpress support forums too if you haven't yet. Best of luck.
0

Mozilla firefox provide add-once "firebug". Which is may be help you. First install mozilla firebug and restart mozilla and load the wordpress page where your file rendering and now press F12 and you can see all the files which in included from wordpress theme and you can also see the location of included files.

1 Comment

I've been using FireBug since the version 1.0 - thank you very much for mentioning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.