In addition to this site I have a personal blog حيث, amongst other things, I post recipes. I’ve recently discovered google’s new recipe search, and have been looking to implement support for microformats / البيانات الجزئية. Google provide a tool for checking your markup, called the “الغنية القصاصة مسموح جي اختبار أداة". When I tried validating one of my recipes, I encountered various errors, which have taken me a while to track down and resolve. Each one is independent, but related, and in all cases the number of errors you are likely to encounter depends largely on the theme you use with your blog. In my case, using the mystique theme, I encountered a substantial number of errors.
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=“me”, 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.
أولا, I added the code from yoast (as shown below) to functions.php
[فب]function yoast_add_google_profile( $contactmethods ) {
// Add Google Profiles
$contactmethods[‘google_profile’] = ‘Google Profile URL’;
return $contactmethods;
}
add_filter( ‘user_contactmethods’, ‘yoast_add_google_profile’, 10, 1);[/فب]
Second, I went to my wordpress profile page and filled in the google profile field with a link to my google profile
ثالث, I edited a line to author.php, مرة أخرى, based on information from yoast, but changed for the Mystique theme
in this section
[فب]
إذا(($curauth->user_url<>‘https://’) && ($curauth->user_url<>")) echo ’
‘.__(‘Homepage:’,‘mystique’).’ <a href=“ ‘.$curauth->user_url.’ ”>’.$curauth->user_url.’</ا>
‘;
إذا($curauth->yim<>") echo ’
‘.__(‘Yahoo Messenger:’,‘mystique’).’ <a href=“ymsgr:sendIM?’.$curauth->yim.’ ”>’.$curauth->yim.’</ا>
‘;
إذا($curauth->jabber<>") echo ’
‘.__(‘Jabber/GTalk:’,‘mystique’).’ <a href=“gtalk:chat?jid=’.$curauth->jabber.’ ”>’.$curauth->jabber.’</ا>
‘;
إذا($curauth->aim<>") echo ’
‘.__(‘AIM:’,‘mystique’).’ <a href=“aim:goIM?screenname=’.$curauth->aim.’ ”>’.$curauth->aim.’</ا>
‘;
[/فب]
add this extra line
[php highlight=“5”]
إذا(($curauth->user_url<>‘https://’) && ($curauth->user_url<>")) echo ’
‘.__(‘Homepage:’,‘mystique’).’ <a href=“ ‘.$curauth->user_url.’ ”>’.$curauth->user_url.’</ا>
‘;
إذا($curauth->yim<>") echo ’
‘.__(‘Yahoo Messenger:’,‘mystique’).’ <a href=“ymsgr:sendIM?’.$curauth->yim.’ ”>’.$curauth->yim.’</ا>
‘;
إذا($curauth->jabber<>") echo ’
‘.__(‘Jabber/GTalk:’,‘mystique’).’ <a href=“gtalk:chat?jid=’.$curauth->jabber.’ ”>’.$curauth->jabber.’</ا>
‘;
إذا($curauth->aim<>") echo ’
‘.__(‘AIM:’,‘mystique’).’ <a href=“aim:goIM?screenname=’.$curauth->aim.’ ”>’.$curauth->aim.’</ا>
‘;
إذا($curauth->google_profile<>") echo ’
<a href=“ ‘ . $curauth->google_profile . ’ ” rel=“me”>Google Profile</ا>
‘;
[/فب]
التالي, I edited single.php to add rel=“author” to the link to my author page. In the Mystique theme this is found towards the bottom of the file, within the (long) خط(ق) as shown below. I have added the rel=“author” at the end of the first line before the href=” part
[فب]
printf(__(‘This entry was posted by %1$s on %2$s at %3$s, and is filed under %4$s. Follow any responses to this post through %5$s.’, ‘mystique’), ‘<a title=“ ‘. sprintf(__(“ href=“ ‘. get_author_posts_url(get_the_author_meta(‘ID’)) .’ ” rel=“author”>’. get_the_author() .’</ا>’,
get_the_time(get_option(‘date_format’)),get_the_time(get_option(‘time_format’)), get_the_category_list(‘, ’), ‘<a title=“RSS 2.0″ href=“ ‘.get_post_comments_feed_link($post->ID).’ ”>RSS 2.0</ا>’);echo ’ ‘;
[/فب]
ثم, finally add the same rel=“author” to line 670 of core.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. The second problem(ق) were with the hfeed / hentry section and included the following:
ملكة جمال جي المطلوبة hCard "الكاتب".
جي تحذير: يجب تعيين حقل واحد على الأقل لHcard.
جي تحذير: يجب تعيين حقل واحد على الأقل لHatomEntry.
جي تحذير: ملكة جمال جي حقل مطلوب "دخول عنوان".
جي تحذير: ملكة جمال جي حقل مطلوب "تحديث".
جي تحذير: ملكة جمال جي المطلوبة hCard "الكاتب".
الحل(ق):
Use the wordpress editor to edit single.php
Find the code
[xhtml]</pre>
<h1 class=“title”></h1>
<pre>
[/xhtml]
replace this with…
[xhtml]</pre>
<h1 class=“title entry-title”></h1>
<h2 class=“updated”></h2>
<h2 class=“vcard”></h2>
<pre>
[/xhtml]
A final note — Don’t just copy and paste the code from this page, as for some reason (I’m guessing character encoding) it wont work. 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
“Hi James I realise it has been a long while, but I just checked this on windows 11 (build 23H2)…”