Title: Problems with gallery shortcode in template
Last modified: August 21, 2016

---

# Problems with gallery shortcode in template

 *  Resolved [John O](https://wordpress.org/support/users/jossoway/)
 * (@jossoway)
 * [13 years ago](https://wordpress.org/support/topic/problems-with-gallery-shortcode-in-template/)
 * Hi,
 * I hope someone can point me in the right direction with this. I am trying to 
   include a wordpress gallery in a page using the do_shortcode method described
   on this page:
 * [http://codex.wordpress.org/Gallery_Shortcode](http://codex.wordpress.org/Gallery_Shortcode)
 * The problem I am having is that whichever way I write the code, it only seems
   to accept the last parameter and ignores everything else. The example below includes
   the correct gallery. sets the link to be a file, but ignores my column setting
   and includes all images attached to the post, rather than the ones I have specified.
   I’ve tried re-ordering the parameters, and it always obeys the last one, but 
   none of the preceding ones.
 *     ```
       <?php
       echo do_shortcode('[gallery include="68,67,66,65,64,63", columns="2", link="file"]');
       ?>
       ```
   
 * Can anyone point me to where I am going wrong? Thanks.
 * John
    :-/

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

 *  [David Choi](https://wordpress.org/support/users/wpthemes777/)
 * (@wpthemes777)
 * [13 years ago](https://wordpress.org/support/topic/problems-with-gallery-shortcode-in-template/#post-3703875)
 * Are you inserting that code into functions.php or template file? If not, then
   just insert
 * [gallery include="68,67,66,65,64,63", columns="2", link="file"]
 * into page’s editor (text tab, not visual tab).
 *  Thread Starter [John O](https://wordpress.org/support/users/jossoway/)
 * (@jossoway)
 * [13 years ago](https://wordpress.org/support/topic/problems-with-gallery-shortcode-in-template/#post-3703878)
 * Hi – it’s in a template, otherwise yes, I’d just use the method you described.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years ago](https://wordpress.org/support/topic/problems-with-gallery-shortcode-in-template/#post-3703887)
 * try without the excess kommas (untested);
 * [http://codex.wordpress.org/Gallery_Shortcode](http://codex.wordpress.org/Gallery_Shortcode)
 *     ```
       <?php
       echo do_shortcode('[gallery include="68,67,66,65,64,63" columns="2" link="file"]');
       ?>
       ```
   
 *  Thread Starter [John O](https://wordpress.org/support/users/jossoway/)
 * (@jossoway)
 * [13 years ago](https://wordpress.org/support/topic/problems-with-gallery-shortcode-in-template/#post-3703889)
 * It works – thanks!

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

The topic ‘Problems with gallery shortcode in template’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [John O](https://wordpress.org/support/users/jossoway/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/problems-with-gallery-shortcode-in-template/#post-3703889)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
