Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #318452

    I am doing a child theme and want to load a modified version of avia.js. I have created the “js” folder inside my child theme folder and put inside my avia.js but theme is still loading parent theme instead of mine.
    Can you help me?

    #318472

    Hi mlabayru!

    Insert this code into the child theme functions.php file.

    
    if(!is_admin()) add_action('wp_enqueue_scripts', 'avia_register_child_frontend_scripts', 100);
    function avia_register_child_frontend_scripts()
    {
    	$child_theme_url = get_stylesheet_directory_uri();
    	wp_dequeue_script('avia-default');
    
    	//register js
    	wp_register_script( 'avia-default-child', $child_theme_url.'/js/avia.js', array('jquery'), 1, true);
    	wp_enqueue_script( 'avia-default-child' );
    }
    

    and place your modified js file into the child theme folder (enfold-child/js/avia.js)

    Best regards,
    Peter

    #318526

    Thank you, that worked perfectly.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘How to load modified avia.js in child theme?’ is closed to new replies.