Last active
August 29, 2015 14:25
-
-
Save cazuki/8659b77ce795af3c3d93 to your computer and use it in GitHub Desktop.
WordPressのRSSに署名などのコンテンツを追加
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
// フィードにコンテンツを追加 | |
function do_post_contents_feeds($content) { | |
global $post; | |
if(has_post_thumbnail($post->ID)) { | |
$content = '<div>' .get_the_post_thumbnail($post->ID). '</div>' .$content. '<div><a href="' .get_permalink($post->ID).'" target="_blank">この記事の続きを読む</a></div><div><a href="' .get_permalink($post->ID). '" target="_blank">' .get_the_title($post->ID). '</a> は <a href="http://example.jp/" target="_blank">ブログタイトル</a> の記事です</div>'; | |
} | |
return $content; | |
} | |
add_filter('the_excerpt_rss', 'do_post_contents_feeds'); | |
add_filter('the_content_feed', 'do_post_contents_feeds'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment