Okay
  Public Ticket #505118
Child Theme - Init.js Issue
Closed

Comments

  •  5
    Philipp started the conversation

    As I just successfully updated to the newest Salient version (6.0.4) I finally also wanted to keep all my future code changes within a child theme. (to save some time)

    That being said, I gave it a first try with the changes I made within the "init.js".

    So what I did was basically:

    1. Installed the Child theme as described. (everything is/was working)

    2. After that I copied the original "init.js" file, made all changes and copied the changed one into this folder:

    ..../wp-content/themes/salient-child/js/

    3. I changed the code of the "functions.php" within the child-theme folder to the following lines of code:

    <?php

    add_action( 'wp_enqueue_scripts', 'javascript_init_script_fix', 20 );

    function javascript_init_script_fix() {

    wp_dequeue_script( 'nectarFrontend' );

    wp_enqueue_script( 'salient-child', get_stylesheet_directory_uri() . '/js/init.js', array( 'jquery' ) );

    }

    ?>

    So what I have read on the forum so far, it should be working like this, right :-) ?

    The problem...as soon as I made those changes, my website is not leaving the rotating preloading image any more.

    To be sure the changed code is ok, I also checked the "init.js" changes I made in the parent js folder. If I overwritte the file there, everything works like a charm.

    That being said, I guess I did something wrong with the child-theme implementation. I just don't know what as I did everything as found and described in the forum here.

    Any hint where I took the wrong turn :-) ?

    Thanks,
    Philipp

















  •  5
    Philipp replied

    Btw: I just uncommented all changes I made within the \"functions.php\" of the child-theme to keep implementing further changes (within the parent theme files for now) until I know how to fix the child-theme issue.

    Hope you guys got an idea what I may have done wrong trying to implement the child-theme \"init.js\" changes :)




  •  5
    Philipp replied
    Short question: Why was my ticket closed?
  •  5
    Philipp replied

    Nothing :-/ ?

  •  1,089
    ThemeNectar replied

    Hey - sorry for the delay, ticksy auto closes tickets that haven\'t had activity in a while

    Could you kindly provide me login credentials so I can take a further look at the issue when loading the child theme init.js

    Cheers

  •  5
    Philipp replied

    I already gave up on this issue with the child theme and switched back to the non-child-theme version. So I guess this ticket can be closed ;-)

  • Andrei replied

    I\'ve come across the exact same issue. Is there any solution?

  •  5
    Philipp replied

    Unfortunately not from my side :-/

  • Andrei replied

    I\'ve discovered the issue is caused by the superfish.js not being loaded. So I\'ve added

    wp_enqueue_script(\'superfish\');

    before

    wp_enqueue_script( \'salient-child\', get_stylesheet_directory_uri() . \'/js/init.js\', array( \'jquery\' ) );

    in the child theme function.php code and the init.js loaded ok.

    But now there\'s an issue with the nectar slider when scrolling. If it has parallax it will stay on top of the content.

    I guess there is still a matter of js loading order.

    I\'m sure this is not the best fix but is a step in the right direction.