How to add Custom Post Title to Your WordPress Feeds
Category: Blog
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 functionmyfeed_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.
Tagged with: wordpress rss feed tips , wordpress tips
Please let us know your comments and suggestions: