Last active
February 4, 2016 10:03
-
-
Save KeSch/11272500 to your computer and use it in GitHub Desktop.
Toolbox-Modul um jedem Eintrag im RSS-Feed am Ende einen Link zum entsprechenden Blogartikel 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: Beitragslink dem RSS-Feed hinzufügen | |
Description: Fügt jedem Feedeintrag am Ende einen Link zum entsprechenden Blogartikel hinzu. [Frontend] | |
Author: Kevin Schludermann | |
Author URI: http://kevinschludermann.com | |
*/ | |
/* Sicherheitsabfrage */ | |
if ( !class_exists('Toolbox') ) { | |
die(); | |
} | |
/* Ab hier kann's los gehen */ | |
function ks_content_after_feed( $content ) { | |
/* Überprüfung und Ausgabe */ | |
if( is_feed() ) { | |
/* Nach dem Feedinhalt Link zum Blogartikel einfügen */ | |
$content = $content . '<hr /><p><strong>Zum Artikel im Blog: <a href="' . get_permalink() . '">' . get_the_title() . '</a></strong></p>'; | |
} | |
return $content; | |
} | |
/* Funktionsaufruf */ | |
add_filter( 'the_excerpt_rss', 'ks_content_after_feed' ); | |
add_filter( 'the_content', 'ks_content_after_feed' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment