Skip to content

Instantly share code, notes, and snippets.

@KeSch
Last active February 4, 2016 10:03
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 KeSch/11272500 to your computer and use it in GitHub Desktop.
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.
<?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