Rss Feed With Images WordPress

  • Bagikan
Rss Feed With Images WordPress

Beritasaatini –

When the wordpress feed setting is short, no images will appear in the rss feed. Actually we can make rss feeds with images in wordpress, even though the feed settings are made short.

Making the feed short of course with the aim of avoiding AGC, but when making the feed short, then you will have a problem that is not displaying images in the rss feed.

Rss Feed With Images WordPress

By adding a little code in function.php, then we can display the image in the rss feed without needing to make the feed full.

Before we give the code, we want to show when the feed is set to be short, pay attention to the image below.

Rss Feed No Images

To check the wordpress feed, please type

Replace with your site’s domain.

Adding Images To WordPress Rss Feed

You don’t need to change the feed setting to full, just leave the feed setting short.

1. Select Appearance

2. Theme Editor

3. In Function.php Add the following code

function image_rss($content) {
	global $post;

	$thumb_id = get_post_thumbnail_id();
	$thumb_url = wp_get_attachment_image_src($thumb_id,'large', true);

	if ( has_post_thumbnail( $post->ID ) ){
		$content="" . '<a href="' . get_permalink( $post->ID ) . '" title="' . $post->post_title . '">' . '' . '<img alt="' . $post->post_title . '" style="max-width: 100%; width: 100%;" src="' . $thumb_url[0] . '" />' . '' . '</a><br/><br/>'. '' . $content;
		return $content;
add_filter('the_excerpt_rss', 'image_rss');
add_filter('the_content_feed', 'image_rss');

After adding the code above, try to check your site’s rss feed again, then the results will be like the image below.

Rss Feed With Images

Source link

Baca Juga  Cara Mengatasi Lupa Password Atau Pola Di HP Android Xiomi , Cara Mudah Reset Plus Unlock Password Hp Android
  • Bagikan