Yes! Just put your entire accordion content as a param of the do_shortcode() function:
e.g.:
$accordion = '[accordion]
[accordion-item title="Title of accordion item"]Drop-down content goes here.[/accordion-item]
[accordion-item title="Second accordion item"]Drop-down content goes here.[/accordion-item]
[/accordion]';
echo do_shortcode($accordion); ?>
Hi,
thanks. I would need to have the content of the accordion be PHP though as well…is this possible?
Yes. You just need to create the string using PHP:
<?php
$accordion = '[accordion]';
$accordion .= '[accordion-item title="' . $your_title_here . '"]';
$accordion .= ''; // Your PHP code for the content of the first item goes here
$accordion .= '[/accordion-item]';
$accordion .= '[/accordion]';
echo do_shortcode($accordion);
?>
Hi,
thank you so much for helping. Unfortunately I can’t get it to work, even the first code without PHP does not display a useable accordion – headline and content are displayed at the sae time, and you cannot close or open it. Maybe Woocommerce does not allow it?
The thing I a trying to achieve is to have the accordion title “description” underneath each product in the checkout order table, and when you click on it the accordion should open and the product description and image should be displayed(by default, Woocommerce does not display anything besides the product name in the checkout table).
My knowledge in PHP is limited but I am really desperate in getting this to work…