Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #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,
    Thanks

    #649702

    Ok, 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…

    #650627

    Hi,

    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,
    Ismael

    #650741

    Hi 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,
    Max

    #651832

    Hi,

    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,
    Ismael

    #651972

    Details in private message!

    Thanks

    #652821

    Hi,

    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,
    Ismael

    #653682

    Sorry, 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

    #655062

    Hi,

    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,
    Ismael

    #655109

    Hi,
    I am so sorry! You’re right! It must have been a cache issue or someting…

    Thanks a lot!
    You can close the thread.

    #655556

    Hi,

    Great, glad you got it working and thanks for letting us know :-)

    Best regards,
    Rikard

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Featured Picture description’ is closed to new replies.