admin管理员组文章数量:1415139
I'm currently using the following code:
function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');
Which does work, but I'm running a few MailChimp RSS emails campaigns and am needing one RSS feed to show the featured image (articles feed) and one where I don't want to show the featured image.
My thought is to do this by category, possibly?
Let me know if more clarification is needed!
Thanks!
I'm currently using the following code:
function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');
Which does work, but I'm running a few MailChimp RSS emails campaigns and am needing one RSS feed to show the featured image (articles feed) and one where I don't want to show the featured image.
My thought is to do this by category, possibly?
Let me know if more clarification is needed!
Thanks!
Share Improve this question edited Aug 27, 2019 at 15:21 Kenan Philips asked Aug 27, 2019 at 15:16 Kenan PhilipsKenan Philips 133 bronze badges1 Answer
Reset to default 1WPBeginner has a nice article " How to Create Custom RSS Feeds in WordPress" that addresses this from a manageable perspective.
They cover creating custom feeds, and using theme templates to customize what your feeds publish.
Take a look.
本文标签: phpCan I add the post featured image to a specific RSS feed
版权声明:本文标题:php - Can I add the post featured image to a specific RSS feed? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745206931a2647683.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论