Themes and Mods

Find Wordpress Themes, Plugins, Joomla Templates, Extensions

Best Joomla Templates

How to add Custom Post Title to Your WordPress Feeds

Do you want to display a different post title in your feeds for your WordPress blogs? You can easily achieve it by just adding a custom function to “functions.php” file in your theme’s folder. No need for any additional plugins.

This example use All in One SEO plugin’s post title for Feed Posts title.

//Add a function to edit the title
function myfeed_custom_title($content){
    global $wp_query;
    $postid = $wp_query->post->ID;
    $post_aiotitle = get_post_meta($postid, '_aioseop_title', true);
    if($post_aiotitle !== '') $content = $post_aiotitle;
    return $content;
}
//Add the hook
add_filter('the_title_rss', 'myfeed_custom_title');

If you want to show a custom field value in your feed title you can just replace the

get_post_meta($postid, '_aioseop_title', true);

to

get_post_meta($postid, 'YOUR_CUSTOM_FIELD_NAME_HERE', true);

Good Luck!

Please don’t forget to post a comment if this post is helpful to you.

More WordPress Tips here

Tagged with: ,


Please let us know your comments and suggestions:

Note: All the templates and extensions listed in this site are from their respective developers and all support requests should be sent directly to the developers. We do not provide support for any of the templates or extensions listed in this site. We just make some revenue if you purchase any of the product through the link from our site.