I know the thread is marked as “resolved”, but since I’m having the same problem I didn’t want to open another one to ask the same exact question.
A quick note: I’ve put the content in one page for each accordion item – I’ve got three, but I’ll be adding more in the future – and then I’m opening the items via the pages ID. Also, I’m using compatibility mode and I have added the corresponding “as” to every item:
[as-accordion openfirst="true" openall="false" clicktoclose="true" class="prova-content"]
[as-accordion-item title="Fierucola, Fierucolona, Rificolona"][my_content id="63"][/as-accordion-item]
[as-accordion-item title="Fiera della Ceramica"][my_content id="69"][/as-accordion-item]
[as-accordion-item title="Titoletto 2"]Contenuto 2.[/as-accordion-item]
[/as-accordion]
I’ve tried using the code you suggested in another thread, adding the “as” here too:
<?php
$content = '[as-accordion]';
$args = array(
'posts_per_page' => '-1',
'post_type' => 'post',
'post_status' => 'publish',
'category__in' => $quicksand_categories
);
$query = new WP_Query( $args );
foreach ($query->posts as $item) {
$categories = wp_get_post_categories($item->ID);
$content .= '[as-accordion-item title="'.get_the_title($item->ID).'"]'.the_content().'[/as-accordion-item]';
}
$content .= '[/as-accordion]';
echo do_shortcode($content);
?>
But I’m afraid it’s not working as I want him too: I’ve put the code into my sidebar.php and, instead of showing the accordion as it did with the shortcodes, (I’ve been using a text widget until now, but I’m changing the theme quite a bit and I don’t need widgets anymore), it shows the content of the page you’re currently viewing.
Additionally, it’s ignoring every CSS customization I’ve made so far – see class=”prova-content” in the original shortcode I’ve used in the text widget.
If you could help me out with this, I’d be most grateful.