Okay
  Public Ticket #2078053
disable accordion.min.js enqueue in child theme
Open

Comments

  • GrupoDNA started the conversation

    Hi, How you are good.

    For my needs integration, I added a accordion plugin with wpbakery into my page.

    I need to adjust the css to show besides images with the selected accordion tab.

    I tried to make it work by  adding

    function my_site_WI_dequeue_script() {
    	wp_dequeue_script( 'businext-accordion' );
    }
    add_action( 'wp_print_scripts', '12313_dequeue_script', 100 );
    

    and then adding the same js code with my changes into the customizer of the theme

    But I couldn't unqueue de js.

    Maybe you have another way around that can make what I need.
    I also looked for a WPbakery plugin for conditional behaviour but not found.

    thank you for your help

  •  572
    Linh replied

    Hello

    What do you want to do with accordion? The wpbakery is provided the accordion element to build the content as normal.

    Thanks

  • GrupoDNA replied

    Hi, Linh,

    the accordion doesn't give capability to set other vc_rows inside the tabs, not even html tags.

    so I need to change the accordion default behaviour to do what they ask me to do.

    please help to do so.

  •  572
    Linh replied

    Hello

    I still can add the vc_row of visual inside the accordion tab as well. 

    http://prntscr.com/of2343

    Please check it again.

    Thanks

  • GrupoDNA replied

    Hi Linh, you're right,

    but I doesn't give me ability to design how I want. I need to interact with the js of the accordion.

    Like : activate roll over on headers instead of clicks and use the show and hide of the javascript to show or hide other blocks.

    please, tell me how to over-ride the accordion javascript or to add some fonction in the theme to make those needs.

    really appreciate

    best.

  •  572
    Linh replied

    Hello

    Unfortunately, there is no function in theme to allow you do it.

    This topic will help you do it:

    https://stackoverflow.com/questions/55524648/how-to-collapse-jquery-accordion-on-mouse-scroll

    Thanks

  • GrupoDNA replied

    Thanks Linh, but if  I do developp some js to make it work as I want, how do I overpass the normal accordion js script of the theme to avoid conflict ?

    Usually in other child theme I used snippet like :

    function my_site_WI_dequeue_script() {
    	wp_dequeue_script( 'businext-accordion' );
    }
    add_action( 'wp_print_scripts', '12313_dequeue_script', 100 );

    can you help making that working please ?

    best

  •  572
    Linh replied

    Yes i can see that script code when searching with google. But it seems the code is not work. 

    You can make a test with default wordpress 2019 theme for the result.

    Thanks

  • GrupoDNA replied

    Hi Linh,

    that's why I am asking, you are suppose to give the answer for that, finding myself the solution, I won't bother you.
    as I need to interact with a default behaviour of your theme to customise myself, I need some help to figure out why an usual snippet is not working.

    You are the expert in your theme.

    thank you to help me to overpass the accordion js enqued into your theme.

    best

  •  572
    Linh replied

    Hello

    If you want to modify the accordion in theme and you can control the code, you can do it in accordion.js file:

    http://prntscr.com/oia45f

    Thanks

  • GrupoDNA replied

    Hi Linh,

    If I do it in accordion.js, it is not going to be update.proof, and every time the theme will be updated, the file has to be edited again.

    it is not into the good practise of Wordpress.

    Please, help to resolve this. 

    best

  •  572
    Linh replied

    Hello

    You can do it in child theme to keep it safe after each update. 

    Thanks

  • GrupoDNA replied

    Linh, hi, yes it is sure into child theme it is better. that's why I was asking to have a working snippet to call the child js file instead of the 

    <script type='text/javascript' src='https://www.dnaassessments.com/wp-content/themes/businext/assets/js/accordion.min.js?ver=1.4.2'></script>

    So I tried by copying the 2 accordion files into same folder into my child theme, and it is not working. this is logical.

    I am pretty sure that  a snippet is needed to enqueue the businext default accordion js file and queue the child accordion js file all this into the functions.php of the child theme.

    Do not want to touch the parent theme,

    please give me correct code.

    regards

  •  572
    Linh replied

    Hi,

    Do you sure that code is working? 

    If you use the child theme, you can follow the replied at  from me to make the change. 

    The code is from the internet, not from the supported function in theme so it might not work property.

    Thank for your understanding. 

  • GrupoDNA replied

    Linh, hi, 

    I do not understand !

    you suggest me to use a code into child theme to make the accordion as I want.
    But this is not going to work if I a javascript code is already managing this same accordion. 
    it is going to make a conflict !

    so before adding the javascript code you send me from stackoverflow, it is needed to disable the default accordion.js or accordion.min.js from the parent theme .

    And this is the snippet  with dequeue_script I am asking you .

    Please provide this bit of code that I can make the suggested in child theme function file.

    thank you for understanding.

  •  572
    Linh replied

    Hi,

    That is your code that you get in stackoverflow. We just suggest to add the code to child theme to keep it safe when theme update.

    Temporary, there is no code that we can provide to change accordion when scroll the mouse in theme.

    Thank for your understanding. 

  • GrupoDNA replied

    Linh, are you a wordpress developer ? 

    if yes, you would understand my last message :
    " it is going to make a conflict !
    so before adding the javascript code you send me from stackoverflow, it is needed to disable the default accordion.js or accordion.min.js from the parent theme"

    if not : please ask to a developer of your company.

    It will not work to add any new code into child theme if the parent theme function for accordion is not disabled; and to do so I need your code  - that it should be close to the dequeue snippet I sent you - to put into the child theme function.php 

    BECAUSE, the usual function dequeue for wordpress does not work with your theme .

    Please help me,

    regards

  •  572
    Linh replied

    Hello

    That code is not from our team. It is in the topic that you sent. You might misunderstand my point. If you find any code for your wishes, you can add the code to functions.php file of child theme to get it but you need be sure the code work. 

    Also our developer is confirmed there is no script to change accordion when scroll mouse. 

    You need custom too many files to get it.

    Thanks

  • GrupoDNA replied

    Linh, I think you missed my point,

    I know this is not from you, and this is why I am asking a code from you , you ask to your developer the wrong thing ! If you don't understand my question, tell me . ! ! ! ! I loose so much time with your answers 

    IT IS NOT POSSIBLE TO INTERACT WITH AN ELEMENT FROM CHILD THEME IF THIS SAME ELEMENT HAS ALREADY A SCRIPT INTERACTING WITH IT FROM PARENT THEME.

    SO IT IS NEEDED FROM YOUR DEVELOPER TEAM TO GIVE THE SNIPPET TO DISABLE THIS ORIGINAL SCRIPT INTO PARENT THEME and then I'll be able to add my own script in child theme.

    only that. 

  •  572
    Linh replied

    Hello

    Yes i have helped you ask the team about the script to change accordion color when scroll mouse but our team is confirmed there is no quick script code to do it. 

    Thank for your understanding. 

  • GrupoDNA replied

    Linh, 

    this is not what I asked .

    I asked since several answers to disable the load of the accordion script from the child theme .

    nothing more complicated. 

    thank you for understanding

  •  572
    Linh replied

    Hi,

    My image will show you the place to disable script for accordion in theme:

    http://prntscr.com/oms88k

    Thanks

  • GrupoDNA replied

    Hi Linh, this is not update proof for wordpress.

    i cannot do that.

    from years in WP, the snippet to insert in the functions.php of child theme is  :

    function my_site_WI_dequeue_script() {
    	wp_dequeue_script( 'businext-accordion' );
    }
    add_action( 'wp_print_scripts', 'my_site_WI_dequeue_script', 100 );

    Should work, but in the case of your theme it is not .

    please ask you developer to give the proper snippet for update proof.

    thank you

  •  572
    Linh replied

    Hello

    You can follow the image to disable script for accordion in theme:

    http://prntscr.com/oms88k

    With that code, we can not responsible for handling errors if you have for your 3rd plugins and customized code. 

    Thank for your understanding. 

  • GrupoDNA replied

    Linh. I know custom code is my responsability.

    You gave me already this img where I can disable the accordion but this is not Theme Update proof .

    !!!

    I am sure your developpers know how to do that. usually this dequeue snippet is "normal" for wordpress-

    please give me code to work

    regards

  •  572
    Linh replied

    Hi

    In my previous message, i showed you the place to disable our theme script for accordion. You can add your custom script code or replace by your code to apply the change. 

    With some bugs related to theme functionality or minor bugs that just do not take too long to customize, we're ready to support. 

    This request takes a lot of time and custom code so we can not help this case.

    The best way to custom and control the function, you should find a freelancer to do it.

    Thank for your understanding.