Quantcast
Channel: Crunchify
Viewing all articles
Browse latest Browse all 1037

WordPress: How to Add Custom Fields to RSS Feed

$
0
0

WordPress Custom Fields WordPress: How to Add Custom Fields to RSS Feed

Adding custom Fields to any WordPress Post is very powerful function, these fields allow you to store extra data about the post without it having to go into the content.

Sometime you have to put below kind of line at the end of each post in your RSS feed. I’m adding below information after each post on Crunchify.

Crunchify Custom Fields WordPress: How to Add Custom Fields to RSS Feed

But custom fields won’t appear in your RSS feed because this will only display your content, so you could miss important information for your RSS readers.

Other must read:

Here is a WordPress snippet to add to your functions.php file to display custom fields in your RSS feed.

function crunchify_feed($content) {  
    if(is_feed()) {  
        $post_id = get_the_ID();  
        $output = '<div><h3>Thanks for visiting..</h3>';  
        $output .= '<p>If you enjoyed this post - Follow me here..</p>';  
        $output .= '<p><strong>Facebook:</strong> <a href='http://facebook.com/Crunchify'>Follow</a></p>';  
        $output .= '<p><strong>Twitter:</strong> <a href='http://twitter.com/Crunchify'>Follow</a></p>';  
        $output .= '</div>';  
        $content = $content.$output;  
    }  
    return $content;  
}  
add_filter('the_content','crunchify_feed');

The post WordPress: How to Add Custom Fields to RSS Feed appeared first on Crunchify.


Viewing all articles
Browse latest Browse all 1037

Trending Articles