Home Forums WoodMart support forum child theme functions.min.js doesn't override main theme functions.min.js

child theme functions.min.js doesn't override main theme functions.min.js

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #187615

    IbrahimY
    Participant

    Hi there,

    As the topic title says.

    I have js/functions.js in child theme working also the style.css and style.min.css

    However it seems I can’t override the functions.min.js

    Do you have a code for this for dequeue?

    this is my code what I have in my child-theme functions.php

    —————————————————–

    <?php
    /**
    * Enqueue script and styles for child theme
    */
    function woodmart_child_enqueue_styles() {
    wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, array( ‘woodmart-style’ ), woodmart_get_theme_info( ‘Version’ ) );
    wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.min.css’, array( ‘woodmart-style’ ), woodmart_get_theme_info( ‘Version’ ) );
    }
    add_action( ‘wp_enqueue_scripts’, ‘woodmart_child_enqueue_styles’, 10010 );

    function woodmart_child_scripts_method() {
    wp_enqueue_script(‘mijn-script’, get_stylesheet_directory_uri() . ‘/js/functions.js’, array( ‘jquery’ ) );
    wp_enqueue_script(‘mijn-script’, get_stylesheet_directory_uri() . ‘/js/functions.min.js’, array( ‘jquery’ ) );
    }

    add_action( ‘wp_enqueue_scripts’, ‘woodmart_child_scripts_method’, 10000000 );

    ———————————————————————–

    Thanks in advance,

    regards,
    Ibrahim

    #187658

    Artem Temos
    Keymaster

    Hello,

    This file can’t be overridden as well as standard WordPress template files. You need to first dequeue the parent theme JS file and then enqueue your own from the child theme. But we suggest you not to override this particular file but simply add another JS file where you can write your code or use our Custom JS in Theme Settings.
    If you still want to do this, you will need to add a localization array as well. You can find how to do this in the file funcitons.php PHP function – woodmart_enqueue_scripts

    Regards

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