WordPress.org

Ready to get started?Download WordPress

Forums

Styling a gallery (5 posts)

  1. exit6
    Member
    Posted 4 years ago #

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

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    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.

  3. exit6
    Member
    Posted 4 years ago #

    Great thanks, I'll try that.

  4. exit6
    Member
    Posted 4 years ago #

    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.

  5. esmi
    Forum Moderator
    Posted 4 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic