Archived topic
Collapse Button
28 replies · Started by Marcel on February 18, 2020
Hi,
I’d like the content that now fills the default Description tab on the woocommerce product page to dynamically fill into the accordion content section.
I believe you're using the code provided here?
https://generatepress.com/forums/topic/collapse-button/#post-1194173
This code has an HTML part. You'll have to add your PHP snippet that prints out dynamic content you want to add within the accordion-container <p> tag.
Thanks Elvin, yes I am using that code.
So I'll need to add a php snippet to print out whatever text is in description tab on the woocommerce product pages to dynamically fill in the accordion content section. That makes sense. I'm not sure how to go about that though. Can anyone point in the right direction?
Sorry, my skills are still limited.
Thank you
Hi there,
You can use this function:
wc_get_template( 'single-product/tabs/description.php' );
Thank you David that works perfectly!!
I was struggling with this for a while and then I realized I didn't have execute php selected below.
You're welcome
Hello, I need your help please I am using this information to create an accordion, it worked fine, but some time later it stopped working on mobiles, I don't know what happens and how to fix it, I have removed and placed it again, but it does not work
Thank you so much.
Hi Jaime,
Can you open a new topic for this? So you can use the private information text field to provide the site details so we can check the inspect the site for any issues.
It still works on my site (on mobile too), in case that helps.
Alexandra, I have checked on different mobiles and they don't work, but if it worked for you, that's good news for me.
Thanks.
Hi Jaime,
if you want to open a new topic where you can share a link to your site, we can take a quick look.
May not be able to fix it but we can check for obvious issues.
Before that - i would recommend disabling any cache/optimization plugins on your site, clear the device browser caches and then see if it works
Hello again,
I opened this topic on February 18, 2020. With David's help, I got the desired result at that time.
Now I would have a weird question: do you think it would be possible for the text to be displayed above the button and not below?
Hi there,
has it really been that long lol
in those jQuery scripts we used the next() function
Which selects the next sibling in the HTML stacking order.
So when clicking on Heading it opens the next element.
If the HTML is swapped then you should be able to simply swap next() for prev() so it targets the previous sibbling element.
David, thank you again! It's working!
All the best.
Awesome - glad to hear that!