This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Reply To: replacing prettyphoto, other scripts…

#1869
Jason Bobich
Keymaster

Hello Israel,

I don’t think you really need any filters specifically on the enque’ing of javascript files because, as you pointed out in your first post, you’ve got WordPress functions to override or de-activate the scripts. I’m doing my best to keep it in the proper “WordPress way” in order for you to have the ability to manipulate scripts without any specific knowledge of the framework, other than seeing where the scripts are enqueued.

http://dev.themeblvd.com/tutorial/framework-scripts/

Your problem seems pretty straight-forward though. You want to disable these different jQuery plugins, but since they are being utilized within themeblvd.js obviously you’re going to get javascript errors because you can call functions that don’t exist. So in addition to removing the jQuery plugin scripts themselves, you need to actually edit themeblvd.js, as well, which calls all of these plugins.

So, you’d just copy themeblvd.js to your Child theme and register it from there.

function my_scripts() {
    wp_register_script( 'themeblvd', get_stylesheet_directory_uri() . '/themeblvd.js' );
}
add_action( 'wp_enqueue_scripts', 'my_scripts', 9 );

Here’s a more descriptive write-up on this: http://dev.themeblvd.com/tutorial/overriding-a-framework-javascript-file/#example-2

Make sure you’re not hooking anything to “wp_head” though for editing these scripts. Make sure you’re hooking everything to “wp_enqueue_scripts” and using the $priority parameter to determine what comes before or after whatever else. All the javascript files for the theme come in at priority 10, which is the default for the add_action function. So, in that example above I wanted my function to come before the framework so my wp_register_script function comes first. So, I passed in 9 as the priority.