Title: Theme Function &#8211; set default image size for Gallery shortcode feature
Last modified: August 19, 2016

---

# Theme Function – set default image size for Gallery shortcode feature

 *  [LayerCake](https://wordpress.org/support/users/layercake/)
 * (@layercake)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/theme-function-set-default-image-size-for-gallery-shortcode-feature/)
 * /wp-includes/media.php line: 784 –
 *     ```
       extract(shortcode_atts(array(
       		'order'      => 'ASC',
       		'orderby'    => 'menu_order ID',
       		'id'         => $post->ID,
       		'itemtag'    => 'dl',
       		'icontag'    => 'dt',
       		'captiontag' => 'dd',
       		'columns'    => 3,
       		'size'       => 'thumbnail,
       		'include'    => '',
       		'exclude'    => ''
       	), $attr));
       ```
   
 * _[Please post code snippets between backticks or use the code button.]_
 * How do you setup up a function in your theme to override the default size ‘thumbnail’–
   to size = full, or large.
 * Thank you!

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

 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/theme-function-set-default-image-size-for-gallery-shortcode-feature/#post-1972900)
 * I think you need to filter the `post_gallery` action hook.
 * This is completely untested:
 *     ```
       function mytheme_gallery_shortcode_filter( $attr ) {
       	extract(shortcode_atts(array(
       		'order'      => 'ASC',
       		'orderby'    => 'menu_order ID',
       		'id'         => $post->ID,
       		'itemtag'    => 'dl',
       		'icontag'    => 'dt',
       		'captiontag' => 'dd',
       		'columns'    => 3,
       		'size'       => 'large'
       	), $attr));
       	return $attr;
       }
       add_filter( 'post_gallery', 'mytheme_gallery_shortcode_filter' );
       ```
   
 * Give something like that a try?
 *  Thread Starter [LayerCake](https://wordpress.org/support/users/layercake/)
 * (@layercake)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/theme-function-set-default-image-size-for-gallery-shortcode-feature/#post-1972949)
 * I think you’re on the right path – but it wasn’t successful. The site still defaults
   to thumbnails.
 *  [cleberkr](https://wordpress.org/support/users/cleberkr/)
 * (@cleberkr)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/theme-function-set-default-image-size-for-gallery-shortcode-feature/#post-1973058)
 * I had the same problem and i’ve found the solution. On media.php on line 777…
   change default values of columns to 1 and of size to LARGE… it should look like
   this after done:
 * extract(shortcode_atts(array(
    ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order ID’,‘
   id’ => $post->ID, ‘itemtag’ => ‘dl’, ‘icontag’ => ‘dt’, ‘captiontag’ => ‘dd’,‘
   columns’ => 1, ‘size’ => ‘large’, ‘include’ => ”, ‘exclude’ => ” ), $attr));
 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/theme-function-set-default-image-size-for-gallery-shortcode-feature/#post-1973059)
 * > On media.php on line 777… change…
 * **NEVER CHANGE CORE WORDPRESS FILES!**
 *  [itsjohn](https://wordpress.org/support/users/itsjohn/)
 * (@itsjohn)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/theme-function-set-default-image-size-for-gallery-shortcode-feature/#post-1973076)
 * this worked for me for the time being,
 *     ```
       remove_shortcode('gallery', 'gallery_shortcode');
       add_shortcode('gallery', 'my_gallery_shortcode');
       ```
   
 * then
 *     ```
       function mjn_gallery_shortcode($attr) {
       ```
   
 * copy everything from media.php within the gallery_shortcode function in here
 *     ```
       }
       ```
   

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

The topic ‘Theme Function – set default image size for Gallery shortcode feature’
is closed to new replies.

## Tags

 * [gallery shortcode](https://wordpress.org/support/topic-tag/gallery-shortcode/)

 * 5 replies
 * 4 participants
 * Last reply from: [itsjohn](https://wordpress.org/support/users/itsjohn/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/theme-function-set-default-image-size-for-gallery-shortcode-feature/#post-1973076)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
