• Resolved Karl Jacobs

    (@karl-jacobs)


    Howdy,

    Trying to figure out how to hide captions on just thumbnail images, while having them show on any other images.

    The problem seems to be that the image caption <p> is not a child of the image, so there’s no direct way in CSS to detect that the image is a thumbnail, and then hide the caption.

    <div id="attachment_322" class="wp-caption alignleft" style="width: 135px"><a href="/expertise/screen-shot-2012-03-01-at-8-22-13-am/" rel="attachment wp-att-322"><img class="size-thumbnail wp-image-322" title="Screen shot 2012-03-01 at 8.22.13 AM" src="/wp-content/uploads/2012/03/Screen-shot-2012-03-01-at-8.22.13-AM-125x125.png" alt="some blue sky that is dark" width="125" height="125" /></a><p class="wp-caption-text">some blue is dark</p></div>

    Anyway of targeting that thumbnail caption without going to an image gallery plugin?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Try using Firefox with the Firebug add-on for this kind of CSS work.
    http://getfirebug.com/

    Thread Starter Karl Jacobs

    (@karl-jacobs)

    I am using that.. 🙂

    But what I’m not seeing is how to identify the caption as part of the thumbnail, since the image is classed as a thumbnail, and not the containing div, so you can’t do a heirarchal style. Not sure I want to rewrite the image function to do this.. 😛

    What about using a> img.size-thumbnail + p.wp-caption-text?

    Thread Starter Karl Jacobs

    (@karl-jacobs)

    Thanks for that tip, I haven’t see that before.

    Trying to get that to work, but it’s not there yet, but I’m still trying.. the problem seems to be that the a containing the img doesn’t have anything that’s targetable, so the descendandt selector doesn’t work.

    Found a good article about these selectors..

    so back to tweaking..

    Thread Starter Karl Jacobs

    (@karl-jacobs)

    Well, I least I learned a few things.. tried every combination, and it doesn’t appear you can combine the selectors to format it as

    a > img.size-thumbnail + p.wp-caption-text

    I tried the elements separately, and targeted the a otherwise, and then it worked, but no way to pick up the .size-thembnail class..

    hmm…

    Thread Starter Karl Jacobs

    (@karl-jacobs)

    looks like it can’t be done. Back to manually deleting the captions on thumbmnails. (or doing some php work to add classes that can be targeted by the css.)

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Hide caption on thumbmail images?’ is closed to new replies.