Skip to content

Instantly share code, notes, and snippets.

@KeSch
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KeSch/11229105 to your computer and use it in GitHub Desktop.
Save KeSch/11229105 to your computer and use it in GitHub Desktop.
Toolbox-Modul um das Beitragsbild dem RSS-Feed hinzuzufügen.
<?php
/*
Module Name: Beitragsbild im RSS-Feed
Module-URL: http://kevinschludermann.com/toolbox-module-rss-feed/
Description: Fügt das Beitragsbild dem RSS-Feed in Originalgröße hinzu. [Frontend]
Author: Kevin Schludermann
Author URI: http://kevinschludermann.com
*/
/* Sicherheitsabfrage */
if ( !class_exists('Toolbox') ) {
die();
}
/* Ab hier kann's los gehen */
function ks_post_thumbnail_feeds( $content ) {
global $post;
/* Überprüfung und Ausgabe */
if( has_post_thumbnail($post->ID) ) {
$content = '<p><center>' . get_the_post_thumbnail($post->ID) . '</center></p>' . $content;
}
return $content;
}
/* Funktionsaufruf */
add_filter( 'the_excerpt_rss', 'ks_post_thumbnail_feeds' );
add_filter( 'the_content_feed', 'ks_post_thumbnail_feeds' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment