Problem with expanding & Collapsing
-
Hello.
Is there any way to edit the plugin so the first accordion on the page would stay collapsed?
https://ww.wp.xz.cn/plugins/responsive-accordion-and-collapse/
-
Hello Jessevaar,
Please follow my steps here to expand first accordion every time –
Step-1 : open your plugin directory and then open responsive-accordion-and-collapse plugin folder
Step-2 : now follow this path responsive-accordion-and-collapse > front > ac-content.php , open ac-content.php this file on any editor ,
Step-3 : find below code at line near no. 134 in this file –
<!-- Inner panel Start --> <div class="wpsm_panel wpsm_panel-default"> <div class="wpsm_panel-heading" role="tab" > <h4 class="wpsm_panel-title"> <a class="<?php if($i!=1){ echo "collapsed"; } ?>" data-toggle="collapse" data-parent="<?php if($enable_toggle=="no") { ?>#wpsm_accordion_<?php echo $post_id; ?> <?php } ?>" href="#ac_<?php echo $post_id; ?>_collapse<?php echo $i; ?>" > <?php if($op_cl_icon == 'yes' ) { ?> <span style=" background-color:<?php echo $acc_title_bg_clr; ?>; color: <?php echo $acc_title_icon_clr; ?>; float:<?php echo $acc_op_cl_align; ?>; padding-top: 12px; padding-bottom: 12px; line-height: 1.1; padding-left: 15px; padding-right: 15px; display: inline-block;" class="fa fa-<?php if($i==1){ echo "minus"; } else { echo "plus"; } ?>"></span> <?php } ?> <span class="ac_title_class"> <?php if($acc_title_icon == 'yes' ) { if($enable_single_icon=="yes") { ?> <span style="margin-right:6px;" class="fa <?php echo $accordion_title_icon; ?>"></span> <?php } } if($accordion_title == '' ) { echo "no title"; } else { echo $accordion_title; } ?> </span> </a> </h4> </div> <div id="ac_<?php echo $post_id; ?>_collapse<?php echo $i; ?>" class="wpsm_panel-collapse collapse <?php if($i==1){ echo "in"; } ?>" > <div class="wpsm_panel-body"> <?php echo do_shortcode($accordion_desc); ?> </div> </div> </div> <!-- Inner panel End -->step : 4 replace it with below code –
<!-- Inner panel Start --> <div class="wpsm_panel wpsm_panel-default"> <div class="wpsm_panel-heading" role="tab" > <h4 class="wpsm_panel-title"> <a class="<?php if($i!=1){ echo "collapsed"; } ?>" <?php if($i!=1){ ?> data-toggle="collapse" <?php } ?> data-parent="<?php if($enable_toggle=="no") { ?>#wpsm_accordion_<?php echo $post_id; ?> <?php } ?>" <?php if($i!=1){ ?> href="#ac_<?php echo $post_id; ?>_collapse<?php echo $i; ?>" <?php } ?> > <?php if($op_cl_icon == 'yes' ) { ?> <span style=" background-color:<?php echo $acc_title_bg_clr; ?>; color: <?php echo $acc_title_icon_clr; ?>; float:<?php echo $acc_op_cl_align; ?>; padding-top: 12px; padding-bottom: 12px; line-height: 1.1; padding-left: 15px; padding-right: 15px; display: inline-block;" class="fa fa-<?php if($i==1){ echo "minus"; } else { echo "plus"; } ?>"></span> <?php } ?> <span class="ac_title_class"> <?php if($acc_title_icon == 'yes' ) { if($enable_single_icon=="yes") { ?> <span style="margin-right:6px;" class="fa <?php echo $accordion_title_icon; ?>"></span> <?php } } if($accordion_title == '' ) { echo "no title"; } else { echo $accordion_title; } ?> </span> </a> </h4> </div> <div id="ac_<?php echo $post_id; ?>_collapse<?php echo $i; ?>" class="<?php if($i!=1){ ?> wpsm_panel-collapse collapse_<?php echo $post_id; ?> collapse <?php } ?>" > <div class="wpsm_panel-body"> <?php echo do_shortcode($accordion_desc); ?> </div> </div> </div> <!-- Inner panel End -->Finally save your code and then your accordion.
Let me know if you will get any issue there.
Thanks
Hello,
Sorry to jump in, just dealing with the same issue too. Tried the above code and it seems to fix the accordion open, with no option to close again.
Is there just a way of making closed the default when you land on the page?
Thanks
Hello bexspence,
I have create above script for Jessevaar requirement, so that’s why first accordion is not going to be close.
I have try to make it as you want but when i have click on second accordion then first one is going to be hide.
I will try my best to create your accordion as like you want.
I will provide you a solution very soon.
Thanks
Hello wpshopmart and thank you for your fast response.
I Tried the code you provided and it now makes the first accordion to stay open without closing it when clicking on it.
In any case of misunderstanding I would like to have all accordions to be collapsed until I click one or any of them open.
So do you want to show all accordion opened when page is going to be load.
am i right?
Thanks
or do you want to hide all accordion content on load ?
Yes, I want to hide all accordion content on load.
Thank you.
Thanks, there will only be one accordion on the page so I just need it as per Jessevaar.
Thanks
Hi wpshopmart, I am really enjoying your app. Great job! I would also like to know how to collapse all of the accordions when a page loads. Could you walk me through the process?
Ok Jessevaar,
replace it with previous code of ac-content.php –
<!-- Inner panel Start --> <div class="wpsm_panel wpsm_panel-default"> <div class="wpsm_panel-heading" role="tab" > <h4 class="wpsm_panel-title"> <a class="<?php if($i!=1){ echo "collapsed"; } ?>" data-toggle="collapse" data-parent="<?php if($enable_toggle=="no") { ?>#wpsm_accordion_<?php echo $post_id; ?> <?php } ?>" href="#ac_<?php echo $post_id; ?>_collapse<?php echo $i; ?>" > <?php if($op_cl_icon == 'yes' ) { ?> <span style=" background-color:<?php echo $acc_title_bg_clr; ?>; color: <?php echo $acc_title_icon_clr; ?>; float:<?php echo $acc_op_cl_align; ?>; padding-top: 12px; padding-bottom: 12px; line-height: 1.1; padding-left: 15px; padding-right: 15px; display: inline-block;" class="fa fa-<?php if($i==1){ echo "plus"; } else { echo "plus"; } ?>"></span> <?php } ?> <span class="ac_title_class"> <?php if($acc_title_icon == 'yes' ) { if($enable_single_icon=="yes") { ?> <span style="margin-right:6px;" class="fa <?php echo $accordion_title_icon; ?>"></span> <?php } } if($accordion_title == '' ) { echo "no title"; } else { echo $accordion_title; } ?> </span> </a> </h4> </div> <div id="ac_<?php echo $post_id; ?>_collapse<?php echo $i; ?>" class="wpsm_panel-collapse collapse <?php if($i==1){ echo "in"; echo "style='display:none'"; } ?>" > <div class="wpsm_panel-body"> <?php echo do_shortcode($accordion_desc); ?> </div> </div> </div> <!-- Inner panel End -->Save your code and check your accordion.
Note – enable collapse/toggle from setting for it.
Let me know if you will get any problem.
Thanks
Hello abutcher1,
Please create new support topic for your issue, i will solve you problem there.
Thanks
Thanks wpshopmart! Works great! Thank you so much! Just an FYI, you might want to make this change permanent to your plugin; most people want accordions collapsed when a page loads. Nevertheless, thanks again!
Sure i will add this feature with plugin new update.
Thank you very much ! Works like a charm !
please rate us if like our plugin.
The topic ‘Problem with expanding & Collapsing’ is closed to new replies.