Skip to content

Instantly share code, notes, and snippets.

@cazuki
Last active August 29, 2015 14:25
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 cazuki/8659b77ce795af3c3d93 to your computer and use it in GitHub Desktop.
Save cazuki/8659b77ce795af3c3d93 to your computer and use it in GitHub Desktop.
WordPressのRSSに署名などのコンテンツを追加
// フィードにコンテンツを追加
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