Skip to main content
added 77 characters in body
Source Link
Anjum
  • 974
  • 8
  • 13

you don't need to edit WordPress core files and don't do this, when hooks are available to modify use the_excerpt_rss and the_content_feed filter to add thumbnails or your custom links in feed.

add_filter( 'the_excerpt_rss', 'insert_thumbnail_into_feed' );
add_filter( 'the_content_feed', 'insert_thumbnail_into_feed' );

function insert_thumbnail_into_feed( $content ) {
    global $post;
    if ( has_post_thumbnail( $post->ID ) ){
        // replace thumbnail with yours
        $content = '<p>' .get_the_post_thumbnail( $post->ID, 'thumbnail' ) .'</p>' .$content;p>';
    }

    // addget yourpost customcontent linkand replace feed content with
    // you can also limit/filter the content to exclude shortcodes and html code etc.
    $content .= '<a'<p>' href="http://example.com/link/">Customget_the_content() Link<.'</a>';p>';

    return $content;
}

EDIT: place this code in your theme's functions.php

you don't need to edit WordPress core files and don't do this, when hooks are available to modify use the_excerpt_rss and the_content_feed filter to add thumbnails or your custom links in feed.

add_filter( 'the_excerpt_rss', 'insert_thumbnail_into_feed' );
add_filter( 'the_content_feed', 'insert_thumbnail_into_feed' );

function insert_thumbnail_into_feed( $content ) {
    global $post;
    if ( has_post_thumbnail( $post->ID ) ){
        // replace thumbnail with yours
        $content = '<p>' .get_the_post_thumbnail( $post->ID, 'thumbnail' ) .'</p>' .$content;
    }

    // add your custom link
    $content .= '<a href="http://example.com/link/">Custom Link</a>';

    return $content;
}

EDIT: place this code in your theme's functions.php

you don't need to edit WordPress core files and don't do this, when hooks are available to modify use the_excerpt_rss and the_content_feed filter to add thumbnails or your custom links in feed.

add_filter( 'the_excerpt_rss', 'insert_thumbnail_into_feed' );
add_filter( 'the_content_feed', 'insert_thumbnail_into_feed' );

function insert_thumbnail_into_feed() {
    global $post;
    if ( has_post_thumbnail( $post->ID ) ){
        // replace thumbnail with yours
        $content = '<p>' .get_the_post_thumbnail( $post->ID, 'thumbnail' ) .'</p>';
    }

    // get post content and replace feed content with
    // you can also limit/filter the content to exclude shortcodes and html code etc.
    $content .= '<p>' .get_the_content() .'</p>';

    return $content;
}

EDIT: place this code in your theme's functions.php

Source Link
Anjum
  • 974
  • 8
  • 13

you don't need to edit WordPress core files and don't do this, when hooks are available to modify use the_excerpt_rss and the_content_feed filter to add thumbnails or your custom links in feed.

add_filter( 'the_excerpt_rss', 'insert_thumbnail_into_feed' );
add_filter( 'the_content_feed', 'insert_thumbnail_into_feed' );

function insert_thumbnail_into_feed( $content ) {
    global $post;
    if ( has_post_thumbnail( $post->ID ) ){
        // replace thumbnail with yours
        $content = '<p>' .get_the_post_thumbnail( $post->ID, 'thumbnail' ) .'</p>' .$content;
    }

    // add your custom link
    $content .= '<a href="http://example.com/link/">Custom Link</a>';

    return $content;
}

EDIT: place this code in your theme's functions.php