I’ve previously written about rich snippets code for 奥秘 2. 也有 通用说明 和主题代码 twenty eleven, 我喜欢 and 论文. Below is updated code for Mystique 3

1. The first problem was with the author information / hrecipe section


You need a google profile. Your google profile must be linked from somewhere on the page, with rel=”我”, AND the main domain of your website must be listed on your google profile links.

I achieved this with the Mystique theme with a series of modifications.

首先, 我加入了代码 yoast (如下所示) 添加到functions.php

[PHP]功能yoast_add_google_profile( $contactmethods ) {
// 加入谷歌简介
$contactmethods[‘google_profile’] = ‘Google Profile 网址’;
返回$ contactmethods;
的add_filter( ‘user_contactmethods’, ‘yoast_add_google_profile’, 10, 1);[/PHP]

第二, I went to my wordpress profile page and filled in the google profile field with a link to my google profile

第三, 我编辑一行author.php, 再次, based on information from yoast, but changed for the Mystique theme

<?如果PHP的(($应用程序—>author->get(‘user_url’)) && ($app->author->get(‘user_url’)!== ‘http://’)): ?>
<?php _ae(‘Home page:’); ?>
<?php endif; ?>

And add the following

<?如果PHP的(($应用程序—>author->get(‘google_profile’)) && ($app->author->get(‘google_profile’)!== ‘http://’)): ?>
<?php _ae(‘Google Profile:’); ?>
<?php endif; ?>

然后我编辑AtomObjectAuthor.php,改变线 213 by adding rel=”作者” so it reads as follows

return ‘<a title="’.$title.’ " href="’.$this->getPostsURL().’" rel="author">’.$this->getName().“</一个>’;

When this is correctly implemented you should get a success message in the snippets testing tool which reads Verified: Authorship markup is correct for this page

2. 第二个问题(s) 均与hfeed / hentry section and included the following:

很有用的文章 “作者”.
警告: 至少一个字段必须为hCard的设置.
警告: 至少一个字段必须为HatomEntry设置.
警告: 缺少必填字段 “入门称号”.
警告: 缺少必填字段 “更新”.
警告: 很有用的文章 “作者”.


Use the wordpress editor to edit single.php


<h1 class="title"></H1>

replace this with

<h1 class="title entry-title"></H1>
<h2 class="updated"></h2>
<h2 class="vcard"></h2>

A final noteDon’t just copy and paste the code from this page, as for some reason (I’m guessing character encoding) 它不会工作. Copy it from here and paste into windows notepad. Then re-copy it from windows notepad (or any other basic plain-text-only editor) and paste into the wordpress editor. Going via notepad loses any hidden encoding or other data which causes a problem so the code is treated as the plain-text it is supposed to be!

发现这个有用? 请不要让我们知道通过下降到低于评论. 如果您想订阅,请使用菜单上的订阅链接右上方. 您还可以通过使用下面的链接社会分享这与你的朋友. 干杯.


2 条评论


Is there an update for this since the code is so much different now using the atom engine?
I have tried to possibly add the code with the atom calls but I am just a little unsure of how to get this to work properly.


尚未为这个代码仍然有效. 然而, I will be doing an update of it all in the near futureonce the issues associated with the migration of the site have been resolved 🙂 Check back in 3-4 weeks 🙂