Wordpress Google代码段测试中的hatom输入错误

Wordpress Google代码段测试中的hatom输入错误,wordpress,rich-snippets,Wordpress,Rich Snippets,几乎可以肯定,我不是第一个有这个问题的人,但当我在Google Snippet测试工具上测试我的代码时,我发现了很多错误,比如: hatom-feed hatom-entry: Fout: At least one field must be set for HatomEntry. Fout: Missing required field "entry-title". Fout: Missing required field "updated&quo

几乎可以肯定,我不是第一个有这个问题的人,但当我在Google Snippet测试工具上测试我的代码时,我发现了很多错误,比如:

hatom-feed

hatom-entry:
    
Fout: At least one field must be set for HatomEntry.

Fout: Missing required field "entry-title".

Fout: Missing required field "updated".

Fout: Missing required hCard "author".
我发现了一些关于这方面的信息,但这是针对标准WordPress主题的。我正在使用前面的Inovado,我无法确定必须在哪个文件中编辑此数据

有熟悉这个的人吗


我还遇到了代码片段审查的问题。。。在测试结果中表现良好,但不会出现在反谷歌搜索结果中。不知道为什么…

您可以将此代码添加到主题目录中的function.php文件中,它将解决问题

//mod content
function hatom_mod_post_content ($content) {
if ( in_the_loop() && !is_page() ) {
$content = '<span class="entry-content">'.$content.'</span>';
 }
 return $content;
}
add_filter( 'the_content', 'hatom_mod_post_content');

//add hatom data
function add_mod_hatom_data($content) {
$t = get_the_modified_time('F jS, Y');
$author = get_the_author();
$title = get_the_title();
if(is_single()) {
    $content .= '<div class="hatom-extra"><span class="entry-title">'.$title.'</span> was    last modified: <span class="updated"> '.$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>';
}
return $content;
}
add_filter('the_content', 'add_mod_hatom_data');
//修改内容
功能hatom_mod_post_内容($content){
如果(在循环()和&!中是页面()){
$content='.$content'.';
}
返回$content;
}
添加过滤器(‘内容’、‘hatom_mod_post_content’);
//添加hatom数据
函数add_mod_hatom_数据($content){
$t=获取修改的时间('fjs,Y');
$author=获取作者();
$title=获取标题();
if(is_single()){
$content.=''.$title.'上次修改:'.$t.'由'.$author.'修改;
}
返回$content;
}
添加过滤器(“内容”、“添加模块数据”);
该代码包含2个函数。第一个函数将使用WordPress过滤器钩子来为文章添加“条目内容”类。要添加其他基本的hAtom字段,第二个函数将在文章末尾添加一个简短的句子,其中包含更新的时间、文章标题和作者以及所需的微数据