• Does anyone know how to show the captions under thumbnails in a plugin that lists posts by categories?

    We have been using a plugin that list post according to categories to make a news site for a few months, and this seems to be a versatile way of organizing content. The plugin we currently use is “list category posts”, which is included in the wordpress plugin system.

    But I feel we have some way to go before this has sufficient functionality to meet the needs of a news site. I believe there are others who also have this need, and it seems a fruitful direction to work. I myself however am not a programmer, and therefore seek assistance here. Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • try this code as a starting point, which needs to be added to functions.php of your theme:

    [edit: pastebin code removed]

    it is basically a filter which adds the caption – if one exists – to the post thumbnail output, wrapping it into a span to keep img and caption together.

    the possibly needed css is in the commented area at the top of the code.

    caveat: it will act on all post thumbnails site wide.

    (not widely tested, and not tested with the plugin, might need adjusting the css)

    Thread Starter nberidze

    (@nberidze)

    Thank you. I have tried it, and what happened was that only the caption for the most recent thumbnail was shown – next to all thumbnail. If the most recent thumbnail has no caption, no captions are shown.

    Thread Starter nberidze

    (@nberidze)

    So it shows the caption of the last added thumbnail on all thumbnails. The plugin I am using is called ‘list category posts’: http://wordpress.org/extend/plugins/list-category-posts/

    try to replace list_category_posts/include/CatList.php with this code:

    http://pastebin.com/he83SGj7

    (not widely tested)

    an existing caption should be addded after the image, within a span with the css class .thumbnail-caption-text;
    if there is no caption, the output should be unaltered.

    Thread Starter nberidze

    (@nberidze)

    Thanks, but what happens now is that there are no captions, and instead of thumbnails, the full size images are shown.

    Thread Starter nberidze

    (@nberidze)

    Sorry. Ah, yes, the captions are there now. I had chosen a very small text size in the css, so I didn’t notice them at first. Ok. Only thing now is that in one of my widget areas, the images are shown instead of the thumbnails. I’ll investigate further and report back. It’s working ok in at least one widget area. Thanks.

    Thread Starter nberidze

    (@nberidze)

    Using the parameter ‘thumbnail_size’ somehow conflicted with the new code, so that the image was shown in full blown size. If I don’t use this parameter with the plugin, the caption shows. However the caption shows next to the thumbnail, and I’ll have to try to have it underneath. Thank you very much for writing this code. This is an improvement.

    Thread Starter nberidze

    (@nberidze)

    I use .lcp_catlist img { float: left; margin: 3px; } in style.css, so the thumbnail is to the left. To the right of it is, first, the title of the post, then its date, and then comes the caption. Then a line break, and the post excerpt, which floats around the thumbnail. The caption comes kind of in the middle of nowhere, and I want it under the thumbnail.

    Thread Starter nberidze

    (@nberidze)

    I changed the CatList.php so that the caption is not a span, but a div. Then added ‘clear: both’ and ‘float: left’ to this div’s properties in style.css. Now the caption appears underneath the thumbnail in a useable fashion.

    Thanks a lot for your help!

    This modification might be of use to others, so the author of the plugin should maybe have a note. I can send the author a mail about it.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘thumbnail captions, using a plugin’ is closed to new replies.