I’m using wordpress’ native media manager. I have a problem. I can show the title under the image. But I want also to show the description. Is it possible to do?
Leave a Reply
You must be logged in to post a comment.
I’m using wordpress’ native media manager. I have a problem. I can show the title under the image. But I want also to show the description. Is it possible to do?
You must be logged in to post a comment.
This is actually quite easy: You just hijack the short code handler for image captions, grab the
post_content
(the image description) and set its content as a value for the attributecaption
. Then you call the original shortcode handler.The following example requires the shortcode attribute
desc
set to1
to make the magic work:Now you add a description â¦
⦠use regular caption markup â¦
⦠and get the description nicely formatted:
If you add the parameter
desc
with a value different from1
to the caption (desc=0
for example) no description will be used.Download on GitHub.
First of all thanks to toscho for his solution. In case anybody needs the code for his theme instead of using it as a plugin here is the adopted code rewritten as a single function:
Tested this with WordPress 4.2.3 and it’s working without any problems.
I found the solution. I wanted to show description under all pictures. This solution works great.Thanks to https://wordpress.stackexchange.com/users/3687/tom-auger