Title: Using shortcode in single.php?
Last modified: August 21, 2016

---

# Using shortcode in single.php?

 *  Resolved [tamiheaton](https://wordpress.org/support/users/tamiheaton/)
 * (@tamiheaton)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/using-shortcode-in-singlephp/)
 * Hi – For layout reasons, i need to insert the shortcode directly into the single.
   php file. I am not able to get this to work at present.
 * I tried inserting the shortcode directly into the single.php file, and the code
   was visible in the content area rather than displaying thumbnails. I have also
   tried using shortcode_do for display… but this does not seem to be working, either.
   I used:
 * <?php echo do_shortcode( ‘[thumbnailgrid cat=’4′ posts=’12’ type=’post’ order_by
   =’date’ order=’ASC’]’ ); ?>
 * i also tried this – because it was in an example the wordpress site had in their
   instructions for shortcode_do:
 * <?php echo do_shortcode( ‘[thumbnailgrid cat=’4′ posts=’12’ type=’post’ order_by
   =’date’ order=’ASC’]’ ) ?>
 * then i tried using the advanced custom fields plugin to add another text field
   to my page that i could display separately from the main one… but it had the 
   same results as if i had inserted the shortcode directly into single.php.
 * i am not really a php developer and i’m not sure what i’ve got wrong. i have 
   been unable to find a reference in the documentation that explains what code 
   to use to insert directly into the post code, so i’m winging it on my own here.
   can anyone help?
 * thanks!
 * [https://wordpress.org/plugins/thumbnail-grid/](https://wordpress.org/plugins/thumbnail-grid/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [A. Jones](https://wordpress.org/support/users/nomadcoder/)
 * (@nomadcoder)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/using-shortcode-in-singlephp/#post-4709675)
 * I’m not sure, I’ve never used do_shortcode but maybe this will work. I replaced
   the quotes containing your string with double quotes.
 * echo do_shortcode( “[thumbnailgrid cat=’4′ posts=’12’ type=’post’ order_by=’date’
   order=’ASC’]” );
 * Usually I would use single quotes to contain the text and double quotes in the
   text but it should work the other way around too.
 * echo do_shortcode( ‘[thumbnailgrid cat=”4″ posts=”12″ type=”post” order_by=”date”
   order=”ASC”]’ );
 *  Thread Starter [tamiheaton](https://wordpress.org/support/users/tamiheaton/)
 * (@tamiheaton)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/using-shortcode-in-singlephp/#post-4709832)
 * that did it!! thank you so much, i really, really appreciate the help 🙂 i love
   this plugin, and i’m planning to use it again on my very next project 🙂
 *  Plugin Author [A. Jones](https://wordpress.org/support/users/nomadcoder/)
 * (@nomadcoder)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/using-shortcode-in-singlephp/#post-4709893)
 * Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Using shortcode in single.php?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/thumbnail-grid.svg)
 * [Featured Image Thumbnail Grid](https://wordpress.org/plugins/thumbnail-grid/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/thumbnail-grid/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/thumbnail-grid/)
 * [Active Topics](https://wordpress.org/support/plugin/thumbnail-grid/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/thumbnail-grid/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/thumbnail-grid/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [A. Jones](https://wordpress.org/support/users/nomadcoder/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/using-shortcode-in-singlephp/#post-4709893)
 * Status: resolved