• X

    How to Show Thumbnail for Partial feed in WordPress

    By in WordPress

    Bluehost hosting

    In the past I talked a lot about Partial feed (Summery feed) and why you should have Partial feed. As it is, if you have read why images are important for blog, you would understand that it helps in increasing CTR. Though when you convert your complete feed into Partial feed, you will notice that Feedburner, Google reader, Facebook and other services won’t show any image for post. Specially after implementing partial feed, I noticed that traffic from Facebook went down and it’s because of less CTR due to no thumbnail.

    top wordpress plugins How to Show Thumbnail for Partial feed in WordPress

    This post is for all those who have implemented Partial feed (Summery feed) and want to show image in the feed. You need to have knowledge of FTP and basic copying-pasting code. If not, you can always take help of our WordPress services. Getting back to tutorial, all we need to do is edit two files from wp-includes folder (feed-rss2.php and functions.php).

    Showing Thumbnail on Facebook and Other RSS readers: WordPress

    Login to your FTP account and browse to wp-includes folder and download and make a back of above mentioned files in a folder. Now lets start with editing of these files to show thumbnail.

    Editingwpinclude thumb How to Show Thumbnail for Partial feed in WordPress

    Editing feed-RSS2 file:

    Click on open and edit feed-rss2.php file and search for line:

    <?php the_excerpt_rss() ?-->

    the excerpt rss 550x127 How to Show Thumbnail for Partial feed in WordPress
    And add this line before above code and after [CDATA[

    <?php echo '<img src="'.get_first_image().'" alt="" />' ?>

    echo 550x124 How to Show Thumbnail for Partial feed in WordPress

    Save the file and upload it back to wp-includes folder.

    Editing WordPress functions.php:

    Now open Functions.php from Wp-includes folder and search for this line: "Removes site option by name"

    And add this code as shown the image:

    function get_first_image() {
    global $post, $posts;
    $first_img = '';
    ob_start();
    ob_end_clean();
    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i’, $post->
    post_content, $matches);
    $first_img = $matches [1] [0];
    if(empty($first_img)){
    //Defines a default image
    $first_img ="http://domain.com/default.jpg";
    }
    return $first_img;
    }

    Thumbnail1 550x222 How to Show Thumbnail for Partial feed in WordPress
    Don't forget to replace the http://www.yourdomain.com/default.jpg with your default image link. Save and upload the file back.
    Now it will take almost 24 hours for Feed-burner to update your feed or if you use direct feed on Facebook, you will see thumbnail from next published post.

    Thumbnail example1 550x437 How to Show Thumbnail for Partial feed in WordPress

    This also makes your feed looks good else after implementing Partial feed you might have noticed less traffic from Feeds or Facebook (Atleast true in my case).

    Do let me know if you find any issue implementing thumbnail for partial feed and I will try to answer asap. You can also use our Facebook fan page to ask questions.

    Get Free Blogging updates in your Email

    Find more Topics based on Keywords

    Article by

    Harsh has written 1263 articles.

    If you like This post, you can follow ShoutMeLoud on Twitter. Subscribe to ShoutMeLoud feed via RSS or EMAIL to receive instant updates.

    { 5 comments… read them below or add one }

    Rajan Balana @ DreamBloggers

    Hey Harsh, The code shown in the image is not matching with the code shown in the code

    Reply

    Manendra

    Since from a couple of days i am wondering Y my images are not displaying in my FB RSS and thank Q for the tutorial i made the necessary changes as you mentioned above hope i’ll see the thumbnails in coming 24Hrs.

    Reply

    Harsh Agrawal

    @Rajan
    This is the same code which I’m using on ShoutMeLoud.
    @Manendra Have you encountered any kind of error after adding these codes?

    Reply

    aman

    Great Info harsh , I was Really not Knowing of this feature, will sure do it..thanks…

    Reply

    Abhay Singh

    Hi Harsh.
    I want to display feed in sidebar with rss widget of my subdomain .
    Please Give me solution.

    Reply

    Leave a Comment

    Previous post:

    Next post:

    `