我正在尝试设置用户将看到的 RSS 提要的样式。因此,他们所看到的只是帖子中的图像、所见即所得编辑器中的文本以及作为主题一部分的按钮。
这是 single.php 模板文件中的按钮:
<div class="bottomgift clearfix">
<a target="_blank" rel="nofollow" href="<?php getCustomField('Affiliate Link'); ?>" class="go-button">Go</a>
</div>
如何添加所有这些来设置 RSS 提要的样式?
在 Functions.php 中
function modRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'full', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
}
$content = $content . '<a href="' . getCustomField('Affiliate Link') . '">Go</a>';
return $content;
}
add_filter('the_excerpt_rss', 'modRSS');
add_filter('the_content_feed', 'modRSS');