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

    Wordpress 4.9.8
    Enfold 4.5
    WooCommerce 3.5.1
    Vanilla install – no other plugins active except WooCommerce.

    If I move THEMES > ENFOLD > JS > avia.js
    to the child theme THEMES > ENFOLD-CHILD > JS > avia.js
    and then call the new location in the child theme functions.php file using this code:

    function wp_change_aviajs() {
       wp_dequeue_script( 'avia-default' );
       wp_enqueue_script( 'avia-default-child', get_stylesheet_directory_uri().'/js/avia.js', array('jquery'), 2, true );
    }
    add_action( 'wp_print_scripts', 'wp_change_aviajs', 100 );

    kriesi.at/support/topic/override-a-small-part-of-avia-js-only/
    kriesi.at/documentation/enfold/add-custom-js-or-php-script/

    WooCommerce Product Variations Ajax Call – gets a spinning wheel of death. I can’t edit the variations on a product as they don’t load.

    As soon as I remove ‘wp_print_scripts’ from the add action – the function of coarse doesn’t work – but hey! now I can edit my variations.

    There must be a conflict somewhere?

    If I active the Parent theme ENFOLD – then everything works just fine.

    It only happens when trying to load avia.js in the child theme

    I changed the add_action to this:

    add_action( 'wp_enqueue_scripts', 'wp_change_aviajs', 100 );

    ‘wp_enqueue_scripts’ instead of ‘wp_print_scripts’

    and it works!

    Please advise if this is now the correct method

    thanks!

    #1030275

    Hey HuxburyQuinn,

    Yes that is correct, wp_enqueue_scripts is best hook to use when loading css/js scripts.
    I have checked both frontend and backend of your site and I don’t see any js errors, if you don’t experience any issues then I think it’s all good.
    Let us know if you need further assistance.

    Best regards,
    Nikko

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.