Title: Hard Coding the Shortcode
Last modified: August 22, 2016

---

# Hard Coding the Shortcode

 *  Resolved [mutu](https://wordpress.org/support/users/mutu/)
 * (@mutu)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/hard-coding-the-shortcode/)
 * I was trying to hardcode the plug in short code using the following code:
 *     ```
       <?php
              echo do_shortcode('[accordion clicktoclose="true"] ');
              echo do_shortcode('[accordion-item title="Click for Quick Contact Form!"][si-contact-form form='2'][/accordion-item] ');
              echo do_shortcode('[/accordion] ');
       	?>
       ```
   
 * However that just crashes the page.
 * [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)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/hard-coding-the-shortcode/#post-5438650)
 * You only need to call the `do_shortcode()` function once. You can put your entire
   shortcode block into a single PHP variable and pass that into the `do_shortcode()`
   function.
 * The other issue you have is that you are mixing single and double quotes. The
   si-contact-form shortcode uses single quotes where it should use double quotes
   instead.
 * Something like this should work:
 *     ```
       <?php
       $content = '[accordion clicktoclose="true"][accordion-item title="Click for Quick Contact Form!"][si-contact-form form="2"][/accordion-item][/accordion]';
       echo do_shortcode($content);
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Hard Coding the Shortcode’ 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: [11 years, 7 months ago](https://wordpress.org/support/topic/hard-coding-the-shortcode/#post-5438650)
 * Status: resolved