我一直试图验证我的WordPress杂志RSS提要,但仍然有一些我无法删除的错误 .
目前有5个错误:
此Feed无效 . 第54行,第2栏:未定义的项目元素:特色:帖子(6次出现)<featured_post> 1 </ featured_post> <cover_post>常规</ cover_post> <single_fe
... ^第54行,第34列:未定义的项目元素:封面:发布(10次出现)<featured_post> 1 </ featured_post> <cover_post>常规</ cover_post> <single_fe
... ^第54行,第66列:未定义的项目元素:单个:featured_image(5次出现)<featured_post> 1 </ featured_post> <cover_post>常规</ cover_post> <single_fe
... ^第54行,第114列:未定义的项目元素:单个:sidebar_source(10个出现次数)... featured_image> 1blog-side ... ^第54行,第173列:未定义的项目元素:post:views_count(10次出现) ... rce> blog-sidebar8
我进入了 function.php
文件并看到了这个 . 这有点关联,你知道该怎么做吗?谢谢
//Function to add featured image in RSS feeds
function featured_image_in_rss($content)
{
// Global $post variable
global $post;
// Check if the post has a featured image
if (has_post_thumbnail($post->ID))
{
$content = get_the_post_thumbnail($post->ID, 'full', array('style' => 'margin-bottom:10px;')) . $content;
}
return $content;
}
//Add the filter for RSS feeds Excerpt
add_filter('the_excerpt_rss', 'featured_image_in_rss');
//Add the filter for RSS feed content
add_filter('the_content_feed', 'featured_image_in_rss');
/*
image to rss feed
function featured_image_in_feed( $content ) {
global $post;
if( is_feed() ) {
if ( has_post_thumbnail( $post->ID ) ){
$output = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) );
$content = $output . $content;
}
}
return $content;
}
add_filter( 'the_content_feed', 'featured_image_in_feed' );
*/
非常感谢你的帮助