Viewing 2 posts - 1 through 2 (of 2 total)
  • Sometimes customization of a theme can’t be achieved only by editing the php files. In few cases you will need to make changes to the scripts too. In order achieve this you will need to deregister a script from the parent theme and use another in your child theme. Here is the example code that you need to paste in function.php from child theme: NOTE: the provided code is for demonstration purposes. You should adapt it to your own needs. In this example we will be overriding the options.js file

    <?php
    function register_child_options(){
         wp_deregister_script( 'options.js' ); 
         wp_enqueue_script( 'options', get_stylesheet_directory_uri() . '/js/options.js', false,true );
    }
    add_action('wp_enqueue_scripts', 'register_child_options');
    ?>
    

    After this you will be able to use options.js script from your child theme folder.

    This is reply forum post

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.