0

I had errors when uploading banners and photos, I know I must put this code in the child theme to repair it, but I'm using the handy store theme for my store and I have not created any child theme.

Can someone explain me where I should place the code to fix the error?

my code:

function mgt_dequeue_stylesandscripts() {
if ( class_exists( 'woocommerce' ) ) {
    wp_dequeue_style( 'select2' );
    wp_deregister_style( 'select2' );

    wp_dequeue_script( 'select2');
    wp_deregister_script('select2');

} }

Should I put the code in the file 'function' of the theme 'handy store'? or one of dokan?

Vickel
  • 7,879
  • 6
  • 35
  • 56
Felipe Castillo
  • 536
  • 8
  • 25

1 Answers1

0

The best is to put your function in functions.php, but it will never work without a triggered action.

With your code you will need to add something like this :

add_action('wp_enqueue_scripts', mgt_dequeue_stylesandscripts, 99);

The last parameter (99) is the priority, the action will trigger later with higher number.

Benoti
  • 2,170
  • 2
  • 14
  • 15
  • Now another problem has emerged :C is that when I use the function, the text-blocks stop working, literally they disappear, and when I remove the code they come back again, how could I solve it? – Felipe Castillo Nov 05 '16 at 15:25
  • The code of your function only dequeue script if the class woocommerce exist, you maybe need a function instead of class_exists like is_woocommerce_page or something like this and you need to register your own script to make it appear. – Benoti Nov 05 '16 at 15:33
  • hi benoti, I changed the code, I find it complicated because just I'm starting in wordpress and I don't know how it works,I have intermediate knowledge of php and javascript only, I opened another topic, and then I posted the complete function, if you can see it ,I appreciate any suggestions on how I should do this. the topic is this http://stackoverflow.com/questions/40440142/wordpress-problems-with-text-blocks-they-dissapear – Felipe Castillo Nov 05 '16 at 16:01