WordPress RSS: Add image

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

If you would like to show ‘Featured Images’ in WordPress RSS feed, you need to add the following code in functions.php file for your WordPress theme:

add_action('rss2_item', 'add_my_rss_node');
function add_my_rss_node( ) {
  if( has_post_thumbnail() ):
    $thumbnail = wp_get_attachment_url (get_post_thumbnail_id ());
    echo "<image>{$thumbnail}</image>";
  endif;
}

 

REST API + Polylang

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

“… none of the offered feeds [RSS does – mine] seem to include information on the language of the content….”

“It is because Frédéric, polylang’s author has not set his taxonomy property ‘show_in_rest’ => true …”

“The plugin author is not planning to add this to the free version. The pro version will get something that could provide for this…”

function wpse_modify_taxonomy() {
    // get the arguments of the already-registered taxonomy
    $language_args = get_taxonomy( 'language' ); // returns an object

    // make changes to the args
    // in this example there are three changes
    // again, note that it's an object
    $language_args->show_in_rest = true;

    // re-register the taxonomy
    register_taxonomy( 'language', 'post', (array) $language_args );
}
// hook it up to 11 so that it overrides the original register_taxonomy function
add_action( 'init', 'wpse_modify_taxonomy', 11 );

It could be slow, it could be something else, but it works.

Source: How to know the language of a post through the WordPress REST API | WordPress.org


List Of Posts in Images

Yandex.Metrica