• Not sure if this is possible, but I’d like to find a way to exclude captions from thumbnails while keeping them for full-sized images.

    I’m using a custom field to insert thumbnails into front page items in a Revolution News theme. (www.kwantlenchronicle.ca).

    Ideally, I’d like the captions not to appear under the thumbnails, but I need them with the full-sized images on the post pages.

    Any ideas, pointers, help greatly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can certainly do this manually when you first insert the thumbnails. Look at your post in the HTML view (rather than Visual) and remove the [caption] [/caption] tags.

    I’ve dealt with similar issues. I’m not a rocket scientist, but this is what I’ve been able to piece together from various posts. Take it with a grain of salt, and others, please correct me if I’m wrong.

    It’s long, but here goes…

    I’m assuming that you don’t want captions in posts either with a thumb, medium, but you do want them for a full size image that is rendered in ‘attachment.php’ Remember, the caption is merely part of a post’s html content. Bottom line, you want to play with the captions, not WP. Maybe you can do this with pure css and wp-caption and wp-caption-text. But, here is what I’ve learned about images, attachments, attachment_id’s, etc.

    If you want the caption for when the full size image is rendered but not when showing a thumb, you may want to get at the image directly through it’s attachment id. In 2.6.2, I find the relationships between the post id, attachment id and parent ids to be very fragile and somewhat counter intuitive.

    Images when uploaded through the media library are assigned an id and a post type of ‘attachment’ They live in the the wp-posts table as just another post with a post_type of ‘attachment.’ You will see the ID referred to as the attachment id. Also, the image when it is uploaded is assigned a post parent, in effect the post id of the post the image is ‘attached’ to. But don’t be fooled and be careful.

    I learned this the hard way. What I wanted to do was assign one image to one particular post. So, I opened up a post, say Post ID 252 and I uploaded one image and inserted it into the post. Feeling confident, I uploaded some more but DID NOT insert them into the post (again, 252). I thought I’d just throw the images up there and use them latter. Wrong, all of the images I uploaded, whether actually used in the post or not were assigned a parent_id of 252. What I thought would happen would be I’d only have one attachment id’ed image with a post parent of 252 but I got a bunch.

    So, why does this matter to you? Let’s say you add another post, now 253, insert a previously uploaded image into the post. Well, that post really doesn’t have any attachments, hence no attachment id’s associated with it. It has an embedded image, the old fashioned way with html. No database relationship between post 253 and the embedded image exists.

    So, if you want to ‘pull the latest attachment from a post‘, (a marvelous thread by the way) to get at the img src to handle it the way you want, you can’t — no attachment_id.

    I’m not smart enough to figure out the best way around this. It appears you have really two choices — you could parse the html of the post with the embedded but non-attached image and pull out the attachment ID that WP put’s in there, or you can be amazingly careful when using the media uploader, i.e., create post, upload image, insert image, save post, repeat.

    For me, I had to manually go in and get the attachments to really marry up with the posts I wanted them to be attached to with mySQL Query Browser.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Excluding captions’ is closed to new replies.