-
AuthorPosts
-
June 17, 2016 at 10:24 am #649700
Hi,
I wnated to have the featured picture description visible on the archive and the single post pages.
I inserted this code in the loop-index.php:
if (!empty($featured_img_desc)){
echo ‘<p class=”bild_beschr”>’;
echo $featured_img_desc;
echo ‘</p>’;
echo ‘<div class=”clear_beschr”></div>’;
}
and it worked fine as you can see on:But if there is no featured image, it somehow shows content or sometimes the title and i don’t know why… See here:
http://e3zine.com/category/editor-in-chief/
I thought the if (!empty($featured_img_desc)) would do the trick, but it didn’t.
Please help,
ThanksJune 17, 2016 at 10:27 am #649702Ok, i just realized, it shows the excerpt, if you enter one into the excerpt field, and if there is nothing in the excerpt field, it shows the title…
June 20, 2016 at 6:54 am #650627Hi,
Thank you for using Enfold.
Yes, it will show the excerpt if it’s available, if not, it will display the title. Add this function:
function get_the_feature_caption() { $thumbnail_id = get_post_thumbnail_id($the_id); $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment')); if ($thumbnail_image && isset($thumbnail_image[0])) { $caption = '<span>'.$thumbnail_image[0]->post_content.'</span>'; } return $caption; }
Fetch the image description like this:
$featured_img_caption = get_the_feature_caption();
Best regards,
IsmaelJune 20, 2016 at 11:43 am #650741Hi Ismael,
Now it just shows the same caption al all teh posts without images…
See: http://e3zine.com/category/editor-in-chief/I would like no caption there…
Thanks,
MaxJune 22, 2016 at 3:13 am #651832Hi,
Where did you add the following line?
$featured_img_caption = get_the_feature_caption();
Please post the login details here so that we can check it.
Best regards,
IsmaelJune 22, 2016 at 8:28 am #651972Details in private message!
Thanks
June 24, 2016 at 5:21 am #652821Hi,
I think you managed to fixed it with the following:
if (!empty($featured_img_caption)){ echo '<p class="bild_beschr">'; echo $featured_img_caption; echo '</p>'; echo '<div class="clear_beschr"></div>'; }
Best regards,
IsmaelJune 27, 2016 at 7:37 am #653682Sorry, but i don’t understand your last post…
It is not fixed! Please have a look at:
http://e3zine.com/category/editor-in-chief/
There are captions at every post, even though there is no image! They are always the captions of the last image uploaded. Why?
Please hurry, as this is a live site and it is rather bad to have those captions around…Thanks
June 30, 2016 at 4:23 am #655062Hi,
Could you please provide a screenshot of the caption? I don’t see any captions on that page. The “bild_beschr” containers are empty.
Best regards,
IsmaelJune 30, 2016 at 6:55 am #655109Hi,
I am so sorry! You’re right! It must have been a cache issue or someting…Thanks a lot!
You can close the thread.July 1, 2016 at 7:57 am #655556 -
AuthorPosts
- The topic ‘Featured Picture description’ is closed to new replies.