Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-05-06 09:55:53
- ultramega
- Member
- Registered: 2006-02-26
- Posts: 221
How do I... Show caption of image?
First time ever (after making few… txp-sites) I’d like to show caption below article image. Do I really need a plugin to pull caption for the image?
Offline
Re: How do I... Show caption of image?
There’s no native Txp tag that will do it. The caption automatically appears in the title
attribute of the img
tag with any Txp image tag, so you could use javascript to display it on its own.
Code is topiary
Offline
Re: How do I... Show caption of image?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: How do I... Show caption of image?
i recommend you use upm_image. i dont know the other one, but i use upm image a zillion times a week..
Offline
Offline
#6 2009-05-07 08:07:29
- ultramega
- Member
- Registered: 2006-02-26
- Posts: 221
Re: How do I... Show caption of image?
Thanks guys. I hope some of those plugins work with MLP…
Offline
#7 2009-05-07 22:02:26
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I... Show caption of image?
ultramega wrote:
Thanks guys. I hope some of those plugins work with MLP…
upm_image does for sure :)
Offline
Re: How do I... Show caption of image?
Or you could use a custom field and the plugin smd_if like this…
<txp:smd_if field="article_image" operator="isused"> <div class="articleImage"> <txp:article_image /> <br /> <span class="imageCaption"><txp:custom_field name="image_caption" /></span> </div> <!-- //articleImage --> </txp:smd_if>
The plugin detects whether or not you have an article image and if so, whether or not there’s a caption for it. Then it renders your article accordingly.
Note the div class=“articleImage” in the above code. I style this to center the article image below my article headline and above the body content. Something like…
.articleImage { width: 500px; margin: 0 auto; text-align: center; }
… will do it.
The “imageCaption” class is used to style the text of the caption so it’s different from the article body.
You can see it on a site I’m developing at the Olympus E620 Blog
Last edited by bg (2009-05-14 16:35:27)
— Bob
Offline
Re: How do I... Show caption of image?
That’s darn clever, BG.
Keith
Blyth, Northumberland, England
Capture The Moment
Offline
Pages: 1