WordPress.org

Ready to get started?Download WordPress

Forums

How to style [gallery]? (9 posts)

  1. websta
    Member
    Posted 3 years ago #

    I am trying to call and style the WordPress gallery from single.php. Plugins are not an option.

    I am trying to get the gallery to show to the right of the main post area.

    Problems:

    1. The incorrect gallery is showing.
    2. The padding won't get smaller.
    3. I can't get more than 3 thumbnails to display in a single line.

    I have tried this:

    <div style="
    position:relative;
    z-index:1000;
    display: inline;
    list-style-type: none;
    margin: 600px 0 0 340px;
    padding: 0;">
    <?php echo do_shortcode('[gallery id=""]'); ?>
    </div>

    And I have tried this:

    <div style="
    position:relative;
    z-index:1000;
    display: inline;
    list-style-type: none;
    margin: 600px 0 0 340px;
    padding: 0;">
    <?php echo do_shortcode('[gallery id="'.get_the_ID().'"]'); ?>
    </div>

    Neither works. Help?

  2. websta
    Member
    Posted 3 years ago #

    So does this (not getting any responses) mean that the wordpress gallery cannot be effectively styled?

    - Or that the question is complicated?

    - Or that the question is incredibly simple?

    - Or that I offend others in some way?

    If anyone -- anyone at all -- could respond as to their reason why there are no responses, that at least would help me move on.

  3. websta
    Member
    Posted 3 years ago #

    Wow, no responses. Not even something about the question being confusing or whatever.

    I'm wondering if wordpress itself is dying off, since when forums die, that's usually the first step off the cliff.

    What a shame.

  4. Michael Bishop

    Posted 3 years ago #

    WordPress and the forum aren't dying. Unfortunately, this is a volunteer forum, and not everyone might know an answer to a question. Please don't take it personal.

    When you say a plugin isn't an option, do you mean any kind of plugin? I found adding the Cleaner Gallery plugin, it helped. I also found when I was trying to float a gallery to to the right of my content, it was messing up. What I found was .gallery was being set with clear: both; which screwed up my float left and right in my single page layout. I added a clear: none !important; to the theme stylesheet to get around that.

    I also used !important in the theme style sheet to override a few other of the inline styles the gallery was adding to change margins and padding.

    Hope that points you in the right direction…

  5. Michael Bishop

    Posted 3 years ago #

    To be clear I added .gallery {clear: none !important;} as well as a few other specific margin/padding/width settings I wanted all with an !important declaration in the theme's stylesheet. You can add some functions to completely override the inserted CSS and completely write your own, I've seen some posts in the forums on how to do that as well.

    This was just a simple workaround for my own purposes and might help. I'm not a big fan of !important; but I'm also not a fan of inline styling being inserted for me. But a nifty function you get a trade off.

  6. websta
    Member
    Posted 3 years ago #

    Thank you, miklb. I appreciate you taking the time to clarify things for me -- including about the forums. That's good to know.

    The tips you gave were enough for me to figure out how to move things over, and get most everything worked out.

    If I can just figure out how to change the z-index layer of the image that loads when a thumbnail is clicked, I'll be all set...

    Does anyone know what the class(es) of that image is?

  7. Andrew
    Member
    Posted 3 years ago #

    you can check what the class is specifically by going to that page and then viewing the page source. That's how I figure out exactly what's going on in a theme.

  8. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Or install the firebug addon for firefox, or dev toolbar for IE..... then you can just point at an element to view its class, as well as all styles applied to it, and their source

  9. Vicente
    Member
    Posted 2 years ago #

    Is really simple [gallery columns=x] where x is the number of columns to display.

Topic Closed

This topic has been closed to new replies.

About this Topic