PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Toggle text also clickable

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hello,

I found a JS code in the documentation for this, but I can't get it to work without unexpected end of file error.

add_action ('wp_footer', function () {?> window.addEventListener('load', (e) => { document.querySelectorAll('.woof_container_inner h4').forEach(function (h) { if (h.querySelector('a.woof_front_toggle')) { h.style.cursor = 'pointer'; h.addEventListener('click', function (e) { h.querySelector('a.woof_front_toggle').click(); return false; }); } }); });

How can I make this work in my functions.php without error? I just want text aswell as the toggle icon to open my filters.

Thank you!

Hello

Please try this - https://gist.github.com/PavloBorysenko/1e8b22fb47cae15087163472a80ca6d4

Hello again Pablo,

No luck, I commented the entire woof_init_toggles part including jQuery(this).parents('.woof_container_inner').find('.woof_block_html_items').slideToggle(500); and added the new one but it didnt work front end

Any other ideas?

To insert this code correctly you should hire a developer

I am a lightweight developer, but I am good enoug one to comment and replace a function. But it didn't work.

Also, wont this code be overwritten once you update the plugin? If you have a way around that is more flexible I will be very grateful, but maybe I have to fix this"issue" myself (imo it should be the standard for a toggle in any setting on a webpage)

Hope to hear from you.

Hello

Please add in functions.php

add_action( 'wp_footer', function(){
wp_add_inline_script( 'woof_front', woof_add_custom_js(),"after" );
});
function woof_add_custom_js() {
ob_clean();
?>
function woof_init_toggles() {
   jQuery('body').on('click','.woof_container_inner h4', function () {
   if (jQuery(this).children().data('condition') == 'opened') {
  jQuery(this).children().removeClass('woof_front_toggle_opened');
  jQuery(this).children().addClass('woof_front_toggle_closed');
  jQuery(this).children().data('condition', 'closed');
  if (woof_toggle_type == 'text') {
   jQuery(this).children().text(woof_toggle_closed_text);
  } else {
   jQuery(this).children().find('img').prop('src', woof_toggle_closed_image);
  }
   } else {
  jQuery(this).children().addClass('woof_front_toggle_opened');
  jQuery(this).children().removeClass('woof_front_toggle_closed');
  jQuery(this).children().data('condition', 'opened');
  if (woof_toggle_type == 'text') {
   jQuery(this).children().text(woof_toggle_opened_text);
  } else {
   jQuery(this).children().find('img').prop('src', woof_toggle_opened_image);
  }
   }
   jQuery(this).parent().find('.woof_block_html_items').toggle(500);
   return false;
  });
   }
<?php
return ob_get_clean();
}

Hello;

Doesn't work eighter. It saves, but the part within the ob_clean doesnt work, it is greyed out while coding. If I remove php and ob_clean it looks right and saves but nothing happens still..

I bodge fixed with a wide padding on the toggle but you cannot click the h4 still. I expect plenty of people to need this fix - it worked previously.. Hope you can get back to it!

Hello

If you don't have any experience in programming, you should hire a developer.

This solution works great - https://c2n.me/4liuc4X.mp4

I have added the code to functions.php like you said, there is nothing more to it as far as I can see... but the whole page turns white when the file is saved with this code, even if I have nothing else there apart from the opening <?php

Should I deactivate the original code within the plugin maybe?

Hello

Please renew your support

Drop me ftp access - https://share.pluginus.net/image/i20230222134241.png ->https://share.pluginus.net/image/i20230222134615.png - And I will insert this code for you