• Resolved qph9697

    (@qph9697)


    Hi,

    I am trying to add featured image in RSS feed.

    I got this code from a site,

    <?php
    /**
    * Add Featured Image to RSS feed
    *
    **/
    add_filter( ‘the_content’, ‘ld_featured_image_in_feed’ );
    function ld_featured_image_in_feed( $content ) {
    global $post;
    if( is_feed() ) {
    if ( has_post_thumbnail( $post->ID ) ){
    $feat_image_output = get_the_post_thumbnail( $post->ID, ‘full’, array( ‘style’ => ‘height: auto;margin-bottom:2em;max-width: 600px !important;padding-top: 0.75em;width: 100% !important;’ ) );
    $content = $feat_image_output . $content;
    }
    }
    return $content;
    }
    ?>

    But it’s not working.

    Is there any change I must do in this code?

    Please help me with this.

    Thank You.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Featured Image In Feed’ is closed to new replies.