• 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="'.$post->ID.'" size="thumbnail" columns="3"]');
    }

    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="'.$post->post_parent.'" size="thumbnail" columns="4"]');

    Also vote, if this issue is important to you…
    http://wordpress.org/extend/ideas/topic.php?id=1457

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