WordPress.org

Support

Support » Themes and Templates » Styling a gallery

Styling a gallery

  • How can I change the inline css generated by the gallery shortcode? It adds too much padding and makes the images squares.

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

    @esmi

    Forum Moderator

    You could over-ride the inline style by using !important in your stylesheet or remove the inline gallery css altogether by adding:

    add_filter('gallery_style', create_function('$a', 'return "
    <div class=\'gallery\'>";'));

    to your theme’s functions.php file and add your own CSS to your stylesheet.

    Great thanks, I’ll try that.

    No luck on the add_filter, although I’m not sure where to put it in the context of that file. Should it be wrapped in tags?

    Is there a way to display the images more directly, without the shortcode? I’m trying to pull the fist image in the gallery and make it big, then have the rest become thumbnails beneath, but without all the extra css and html that is getting generated. Ideally I’d just get a bunch of img tags with urls.

    Thanks.

    esmi

    @esmi

    Forum Moderator

    No – it shouldn’t be wrapped in anything. Simply adding it to functions.php is sufficient.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Styling a gallery’ is closed to new replies.
Skip to toolbar