2Wordpressのロゴミスティーク3.xのリッチスニペットコード

I’ve previously written about rich snippets code for 神秘的雰囲気 2. もあります 一般的な指示 そして、テーマのためのコード twenty eleven, 私は好き論文. 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.

初めに, 私はからのコードを追加しました ヨースト (以下に示すように) functions.phpへ

[PHP]function yoast_add_google_profile( $contactmethods ) {
// Add Google Profiles
$contactmethods[‘google_profile’] = ‘Google Profile URLは」;
返す$ 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]
<?PHPの場合(($アプリ—>author->ゲット(‘user_url’)) && ($app->author->ゲット(‘user_url’)!== ‘http://」)): ?>
<?php _ae(‘Home page:」); ?>
<?PHP endifの; ?>
[/PHP]

And add the following

[PHP]
<?PHPの場合(($アプリ—>author->ゲット(‘google_profile’)) && ($app->author->ゲット(‘google_profile’)!== ‘http://」)): ?>
<?php _ae(‘Google Profile:」); ?>
<?PHP endifの; ?>
[/PHP]

Then I edited AtomObjectAuthor.php and changed line 213 by adding rel=”著者” so it reads as follows

[PHP]
return ‘<a title="’.$title.’ " href="’.$this->getPostsURL().」" rel="author">’.$this->getName().'</a>」;
[/PHP]

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:

Missing required hCard “著者”.
警告: 少なくとも1つのフィールドにhCardのために設定する必要があります.
警告: 少なくとも1つのフィールドにHatomEntryのために設定する必要があります.
警告: 400.4必要なフィールド “エントリータイトル”.
警告: 400.4必要なフィールド “更新した”.
警告: Missing required hCard “著者”.

ソリューション(S):

Use the wordpress editor to edit single.php

コードを探します

[xhtml]
<h1 class="title"></H1>
[/xhtml]

replace this with

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

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 注釈

gravatarロブ

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.

応答
gravatarジョン・スカイフ

Not yet as this code still works. しかしながら, 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 🙂

応答