-
AuthorPosts
-
November 25, 2016 at 6:22 pm #716981
Hi
I use several accordion shortcode in the same page. I would like that all the toogle close when I open another one, even those of another accordion.Thank you for your help
November 25, 2016 at 7:26 pm #717004Hey stefanos,
Unfortunately it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However if its really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
BasilisNovember 25, 2016 at 7:37 pm #717011try this here – maybe it works for you (in child-theme functions.php)
function only_one_toggle_open_at_the_same_time(){ ?> <script> (function($){ $(window).load(function() { $('.toggler').on('click', function(){ $('.toggler').not(this).next().removeClass('active_tc'); }); $('.toggler').on('click', function(){ $('.toggler').not(this).removeClass('activeTitle'); }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'only_one_toggle_open_at_the_same_time');
by the way : the laurels go to Josue
see also here: https://kriesi.at/support/topic/single-toggles-besides-sibblings-each-other/- This reply was modified 7 years, 11 months ago by Guenni007.
November 28, 2016 at 11:34 am #717674Perfect !
That works very well !
thank you very muchNovember 28, 2016 at 1:08 pm #717716this is now the global solution if you don’t like it for the whole wordpress installation you have to set up some if-clauses
f.e:
function only_one_toggle_open_at_the_same_time(){ if ( is_page(3423) ) { ?> <script> (function($){ $(window).load(function() { $('.toggler').on('click', function(){ $('.toggler').not(this).next().removeClass('active_tc'); }); $('.toggler').on('click', function(){ $('.toggler').not(this).removeClass('activeTitle'); }); }); })(jQuery); </script> <?php } } add_action('wp_footer', 'only_one_toggle_open_at_the_same_time');
on that if clause you can use all conditional tags you know e.g:
if ( is_singular( 'event' ) || is_search() || is_category() || is_page() && !is_page(1307) || is_singular( 'portfolio' ) )
etc.pp
by the way is_home( ) does not work ??? but: is_front_page( ) works
PPS: again something new to me :
is_home() returns only true if it is the blog-post index site
if your landing-page is a page you have to use is_front_page()- This reply was modified 7 years, 11 months ago by Guenni007.
-
AuthorPosts
- You must be logged in to reply to this topic.