Return to Support

Image Caption in Excerpt

Home Forums Graphene WordPress theme Support Image Caption in Excerpt

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #8640
    OPShots
    Member

    Hello I would like to show my image caption below my thumbnails in the excerpt. Is this possible?

    One more question how to I make the Show Post Author’s Info the name (author) it shows in that box clickable and it loads the authors page?

    #41696
    OPShots
    Member

    Hi, just checking in on this. I have combed the support here and across the web and cannot find this answer. Is this possible?

    #41697
    Luko
    Member

    Where exactly in excerpt? Can you provide some link or image? I’m not understanding this through…

    #41698
    Quote:
    Hello I would like to show my image caption below my thumbnails in the excerpt. Is this possible?

    Probably with a child theme.

    Quote:
    Hello I would like to show my image caption below my thumbnails in the excerpt. Is this possible?

    One more question how to I make the Show Post Author’s Info the name (author) it shows in that box clickable and it loads the authors page?

    It already is, isn’t it? If I go here: http://www.opshots.net/2014/01/end-of-an-era-deltas-dc-9-completes-final-scheduled-flight/ and click on “Aeroplanepics0112” it takes me to http://www.opshots.net/author/aeroplanepics/

    Cool favicon, btw.

    #41699
    OPShots
    Member

    Thanks guys for checking. So currently when you create a post using Graphene and you have a front page with posts from your blog it displays the front page posts in excerpt form with a thumbnail and no caption, and one can click on the post to go to the full posting/article and that is when the thumbnail shows with the full text from the article and a single post the one you just clicked on.

    Image example for thumbnail with caption on front page:

    front_page_excerpt_zps88e1dece.jpg

    What I would like is the thumbnail to show on the front page as well on the posts.

    In regards to the author page if you click on the Aeroplanepics0112 under the author in the link Kenneth shared the author by the tile of the post where is says by aeroplanepics0112, however when one goes to the bottom of the full page posting where there is a little author bio that one is not clickable.

    I am using a child theme as well.

    #41700
    Luko
    Member

    For that you have to alter loop.php

    You can copy that file in child-theme folder and add edit code on line 256 (cca.):

    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf( esc_attr__( 'Permalink to %s', 'graphene' ), the_title_attribute( 'echo=0' ) ); ?>">

    <?php the_post_thumbnail( apply_filters( 'graphene_excerpt_thumbnail_size', 'thumbnail' ) ); echo get_post(get_post_thumbnail_id())->post_excerpt;?>
    </a>

    echo get_post(get_post_thumbnail_id())->post_excerpt;” is added code for image excerpt.

    After that you need to style it with css…

    #41701
    OPShots
    Member

    Thank you Luko but that does not appear to be showing the image caption.

    #41702
    Luko
    Member

    Scratch that. Activate graphene_after_post_content action hook and than insert this code in child theme functions.php:

    function featured_image_caption () {
    global $post;

    $thumbnail_id = get_post_thumbnail_id($post->ID);
    $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));

    if ($thumbnail_image && isset($thumbnail_image[0])) {
    echo '<span>'.$thumbnail_image[0]->post_excerpt.'</span>';
    }
    }
    add_action('graphene_after_post_content', 'featured_image_caption')

    You can use different action hook and you can give the span a class for styling with css later.

    #41703
    OPShots
    Member

    Sorry it took me a while to get back to you. This did not work for me either.

    #41704
    Luko
    Member

    Does that code returns any error or it’s just simply doesn’t return thumbnail excerpt?

    Test it on my testsite and it works OK.

    Basic question, where did you entering your image excerpts? Under Edit Media/Caption?

    #41705
    OPShots
    Member

    It does not show at all. Yep the caption is entered in the media caption field.

    #41706
    Luko
    Member

    That’s strange, on my testsite it’s working:

    link_printscreen

    and I only have this in child-theme functions.php:

    function featured_image_caption () {
    global $post;
    $thumbnail_id = get_post_thumbnail_id($post->ID);
    $thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));
    if ($thumbnail_image && isset($thumbnail_image[0])) {
    echo '<span class="thumb_excerpt">'.$thumbnail_image[0]->post_excerpt.'</span>';
    }
    }
    add_action('graphene_after_post_content', 'featured_image_caption')

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.