How to customize WordPress RSS feed

3k views Asked by At

I am about to create a custom RSS feed for my WordPress blog. Although I am pretty unsure of what I am exactly doing.

The feed needs to send following:
Featured image - 600 x 300 px
Description - First 140 characters of the post
Link - Link to the blog post
Title - Title of the blog post

I have followed the guide published by WPBeginner, but sadly it doesn't make me any smarter.

Does anyone have a solution for this? It would be highly appreciated. Thanks guys.

1

There are 1 answers

0
Musk On

Add custom size image in your theme functions.php

/** Custom Image Size For RSS Feed */

function custom_image_sizes() {
    add_theme_support('post-thumbnails');
    add_image_size('custom-rss-image', 600, 300, true);
}
add_action('after_setup_theme', 'custom_image_sizes');

For to limit words you can call the function wp_trim_words

The link and Title are most likely within the original Wordpress template you can choose to re-organize it.

And call it within a custom RSS template.

The Feed templates are located in the /wp-includes/feed-{type}.php files and include formats for rdf, rss, rss2 and atom. They are triggered by feed rewrite rules using a series of actions defined in wp-includes/functions.php and attached using add_action in wp-includes/default-filters.php.

You can lookup the wordpress link.

https://codex.wordpress.org/Customizing_Feeds