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 / microdata. 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 یو آر ایل’;
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.’</a>
‘;
اگر($curauth->yim<>") echo ’
‘.__(‘Yahoo Messenger:’,‘mystique’).’ <a href=“ymsgr:sendIM?’.$curauth->yim.’ ”>’.$curauth->yim.’</a>
‘;
اگر($curauth->jabber<>") echo ’
‘.__(‘Jabber/GTalk:’,‘mystique’).’ <a href=“gtalk:chat?jid=’.$curauth->jabber.’ ”>’.$curauth->jabber.’</a>
‘;
اگر($curauth->aim<>") echo ’
‘.__(‘AIM:’,‘mystique’).’ <a href=“aim:goIM?screenname=’.$curauth->aim.’ ”>’.$curauth->aim.’</a>
‘;
[/پی ایچ پی]
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.’</a>
‘;
اگر($curauth->yim<>") echo ’
‘.__(‘Yahoo Messenger:’,‘mystique’).’ <a href=“ymsgr:sendIM?’.$curauth->yim.’ ”>’.$curauth->yim.’</a>
‘;
اگر($curauth->jabber<>") echo ’
‘.__(‘Jabber/GTalk:’,‘mystique’).’ <a href=“gtalk:chat?jid=’.$curauth->jabber.’ ”>’.$curauth->jabber.’</a>
‘;
اگر($curauth->aim<>") echo ’
‘.__(‘AIM:’,‘mystique’).’ <a href=“aim:goIM?screenname=’.$curauth->aim.’ ”>’.$curauth->aim.’</a>
‘;
اگر($curauth->google_profile<>") echo ’
<a href=“ ‘ . $curauth->google_profile . ’ ” rel=“me”>Google Profile</a>
‘;
[/پی ایچ پی]
اگلے, 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() .’</a>’,
get_the_time(get_option(‘date_format’)),get_the_time(get_option(‘time_format’)), get_the_category_list(‘, ’), ‘<a title=“آر ایس ایس 2.0″ href=“ ‘.get_post_comments_feed_link($post->ID).’ ”>آر ایس ایس 2.0</a>’);echo ’ ‘;
[/پی ایچ پی]
Then, 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:
مس ING ضرورت hCard "مصنف".
انتباہ والے: کم از کم ایک میدان Hcard کے لئے مقرر کیا جانا چاہیے.
انتباہ والے: کم از کم ایک میدان HatomEntry کے لئے مقرر کیا جانا چاہیے.
انتباہ والے: مس کر مطلوبہ فیلڈ "داخلے کی عنوان".
انتباہ والے: مس ING مطلوبہ فیلڈ "اپ ڈیٹ".
انتباہ والے: مس ING ضرورت 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)…”