Title: embedding in template
Last modified: August 30, 2016

---

# embedding in template

 *  Resolved [rudtek2](https://wordpress.org/support/users/rudtek2/)
 * (@rudtek2)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/embedding-in-template/)
 * I’m trying to place this in template as well. I saw another post about it, but
   i can’t see what i’m doing wrong.
 *     ```
       <?php echo do_shortcode ('[accordion]'); ?>
       				<?php
                           $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);
       						?>
           <?php echo do_shortcode ('[accordion-item title="'.get_the_title($item->ID).'"]'.the_content().'[/accordion-item]'); ?>                   
   
                           <?php  }  ?>
       <?php echo do_shortcode ('[/accordion]'); ?>
       ```
   
 * [https://wordpress.org/plugins/accordion-shortcodes/](https://wordpress.org/plugins/accordion-shortcodes/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [philbuchanan](https://wordpress.org/support/users/philbuchanan/)
 * (@philbuchanan)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/embedding-in-template/#post-6822546)
 * The `do_shortcode()` function has to take the entire string of output as a single
   parameter. You’ve used `do_shortcode()` three times. Try something like this:
 *     ```
       <?php
       $content = '[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 .= '[accordion-item title="'.get_the_title($item->ID).'"]'.the_content().'[/accordion-item]';
       }
   
       $content .= '[/accordion]';
   
       echo do_shortcode($content);
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘embedding in template’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/accordion-shortcodes.svg)
 * [Accordion Shortcodes](https://wordpress.org/plugins/accordion-shortcodes/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/accordion-shortcodes/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/accordion-shortcodes/)
 * [Active Topics](https://wordpress.org/support/plugin/accordion-shortcodes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/accordion-shortcodes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/accordion-shortcodes/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [philbuchanan](https://wordpress.org/support/users/philbuchanan/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/embedding-in-template/#post-6822546)
 * Status: resolved