[Resolved] No Image Captions in RSS Feed

Home Forums Support [Resolved] No Image Captions in RSS Feed

Home Forums Support No Image Captions in RSS Feed

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1191281
    Stephan

    Hi guys,

    i’m using GP Premium with Dispatch Theme.

    With your help i was able to show image captions under my featured images, but whatever i do – i cant make it to include them in my rss feed. Thats a problem because i need to display copyright infos of my pics …

    with thhe code beneath i made it to include featured images in rss-feed but the captions are missing.

    could need your help with that

    thanks a lot
    Stephan

    `add_filter( ‘the_content’, ‘featured_image_in_feed’ );
    function featured_image_in_feed( $content ) {
    global $post;
    if( is_feed() ) {
    if ( has_post_thumbnail( $post->ID ) ){
    $output = get_the_post_thumbnail( $post->ID, ‘full’, array( ‘style’ => ‘float:right; margin:0 0 10px 10px;’ ) );
    $content = $output . $content;
    }
    }
    return $content;
    }

    #1191383
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    What code are you using to include captions? You should be able to use the same code in the filter you shared above.

    Let me know ๐Ÿ™‚

    #1191529
    Stephan

    Hi Tom,

    i found this snippet, but it doesnt work – maybe you can give me a tip…

    function featuredtoRSS($content) {
    global $post;
    if ( has_post_thumbnail( $post->ID ) ){
    $content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
    $content = '<div>' . get_the_post_thumbnail_caption( $post->ID  ) . '</div>' . $content;
     }
     return $content;
      }
    #1192052
    Tom
    Lead Developer
    Lead Developer

    Can you share the full function you’re currently using to add featured images to the feed?

    #1192066
    Stephan

    Hi Tom,

    its just this snippet:

    add_filter( ‘the_content’, ‘featured_image_in_feed’ );
    function featured_image_in_feed( $content ) {
    global $post;
    if( is_feed() ) {
    if ( has_post_thumbnail( $post->ID ) ){
    $output = get_the_post_thumbnail( $post->ID, ‘medium’, array( ‘style’ => ‘float:right; margin:0 0 10px 10px;’ ) );
    $content = $output . $content;
    }
    }
    return $content;
    }

    #1192072
    Stephan
    add_filter( 'the_content', 'featured_image_in_feed' );
    function featured_image_in_feed( $content ) {
        global $post;
        if( is_feed() ) {
            if ( has_post_thumbnail( $post->ID ) ){
                $output = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) );
                $content = $output . $content;
            }
        }
        return $content;
    }
    #1192398
    Tom
    Lead Developer
    Lead Developer

    What if you do this?:

    add_filter( 'the_content', 'featured_image_in_feed' );
    function featured_image_in_feed( $content ) {
        global $post;
        if( is_feed() ) {
            if ( has_post_thumbnail( $post->ID ) ){
                $output = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) );
                $output .= '<div>' . get_the_post_thumbnail_caption( $post->ID  ) . '</div>';
                $content = $output . $content;
            }
        }
        return $content;
    }
    #1192498
    Stephan

    Tom, you are a real genius – that was the solution

    thanks a lot!!

    #1193040
    Tom
    Lead Developer
    Lead Developer

    You’re welcome ๐Ÿ™‚

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.