i use a plugin that containing this code and i want to change js location to be located in my template directory instead of plugin without editing the plugin files
class jqueryTimelinrLoad {
public function registerScripts()
{
if (!wp_script_is( 'jquery', 'registered' )) wp_register_script( 'jquery' );
wp_deregister_script('jquery.timelinr');
wp_register_script('jquery.timelinr', JQTL_BASE_URL . '/assets/js/jquery.timelinr-1.0.js', array( 'jquery' ));
}
public function loadScripts() {
if (!is_admin()) {
if (!wp_script_is( 'jquery', 'queue' )) wp_enqueue_script( 'jquery' );
wp_enqueue_script('jquery.timelinr', JQTL_BASE_URL . '/assets/js/jquery.timelinr-1.0.js', array( 'jquery' ));
}
}
}
i try this and it add the new link but old link also still
function drw_timeline_js () {
$result = $GLOBALS["jqueryTimelinrLoad"]->loadScripts();
wp_dequeue_script('jquery.timelinr');
wp_deregister_script( 'jquery.timelinr');
wp_enqueue_script('jquery.timelinr2', get_template_directory_uri() . '/js/jquery.timelinr-1.0.js', array( 'jquery' ));
return $result;
}
add_action('init', 'drw_timeline_js', 1);