Last active
August 29, 2015 14:00
-
-
Save KeSch/11229105 to your computer and use it in GitHub Desktop.
Toolbox-Modul um das Beitragsbild dem RSS-Feed hinzuzufügen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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