Title: [gallery] shortcode CSS is flawed
Last modified: August 19, 2016

---

# [gallery] shortcode CSS is flawed

 *  [mantone](https://wordpress.org/support/users/mantone/)
 * (@mantone)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/gallery-shortcode-css-is-flawed/)
 * [http://wordpress.org/extend/plugins/gallery-shortcode-style-to-head/](http://wordpress.org/extend/plugins/gallery-shortcode-style-to-head/)
 * I found this nifty little plugin that addresses the issue: WordPress 2.7 places
   CSS for shortcode gallery inside the body html
 * i have also used the following in my **functions.php** my template file, so I
   don’t always have to insert [gallery] in every post i make that have uploaded
   photos. I’m lazy, what can I say.
 *     ```
       *** Quotes are messed up, remember to properly replace them in this Sample
   
       add_filter('the_content', 'insertGallery');
       function insertGallery($content) {
       	global $post;
       	return $content.do_shortcode('[gallery id=&quot;'.$post->ID.'&quot; size=&quot;thumbnail&quot; columns=&quot;3&quot;]');
       }
       ```
   
 * Also…
    I have used, do_shortcode function in a **image.php** Template file. Basically
   it’s the [gallery] shortcode with the right ID. Please note, that if you use 
   it in a template file, the Gallery CSS won’t spit out at all. So they won’t be
   styled. I modified the plugin above to do so. Or you can just edit your own CSS
   sheet.
 *     ```
       *** Quotes are messed up, remember to properly replace them in this Sample
   
       echo do_shortcode('[gallery id=&quot;'.$post->post_parent.'&quot; size=&quot;thumbnail&quot; columns=&quot;4&quot;]');
       ```
   
 * Also vote, if this issue is important to you…
    [http://wordpress.org/extend/ideas/topic.php?id=1457](http://wordpress.org/extend/ideas/topic.php?id=1457)

The topic ‘[gallery] shortcode CSS is flawed’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [mantone](https://wordpress.org/support/users/mantone/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/gallery-shortcode-css-is-flawed/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
