Skip to content

Instantly share code, notes, and snippets.

@ThomasKujawa
Last active February 4, 2016 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ThomasKujawa/4b848dacdec2ddaa6dd2 to your computer and use it in GitHub Desktop.
Save ThomasKujawa/4b848dacdec2ddaa6dd2 to your computer and use it in GitHub Desktop.
Wordpress | Toolbox | Featured Images automatisch im WordPress Feed anzeigen
<?php
/*
Module Name: Featured Images automatisch im WordPress Feed anzeigen
Module URI: http://wp-ezine.com/featured-images-automatisch-im-wordpress-feed-anzeigen_469900.html
Description: fügt die Featured Images zum RSS Feed hinzu [Frontend]
Author: Karl-Heinz Klug
Author URI: http://wp-ezine.com/author/karl
*/
/* Sicherheitsabfrage */
if ( !class_exists('Toolbox') ) {
die();
}
/* Ab hier kann's los gehen */
if ( ! function_exists( 'wpez_rss_post_thumbnail' ) ) {
function wpez_rss_post_thumbnail($inhalt) {
global $post;
if(has_post_thumbnail($post->ID)) {
$inhalt = get_the_post_thumbnail($post->ID) . $inhalt;
}
return $inhalt;
}
}
add_filter('the_excerpt_rss', 'wpez_rss_post_thumbnail');
add_filter('the_content_feed', 'wpez_rss_post_thumbnail');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment