0WordPress的标志丰富的片段代码奥秘2.X

除了这个网站,我有一个 个人博客 哪里, 除其他事项外, 我张贴的食谱. 我最近发现了谷歌的新配方搜索, 并一直在寻找实现对微格式的支持 / 微数据. 谷歌检查你的标记提供一个工具, 叫做 ”丰富喀嚓 - 宠物测试ing工具. 当我试图验证我的食谱之一, 我遇到的各种错误, 已经采取了我一段时间来追查和解决.

Each one is inde­pend­ent, but related, and in all cases the num­ber of errors you are likely to encounter depends largely on the theme you use with your blog. In my case, using the mys­tique theme, I encountered a sub­stan­tial num­ber of errors.

1. The first prob­lem was with the author inform­a­tion / hrecipe sec­tion

The solu­tion:

You need a google pro­file. Your google pro­file must be linked from some­where on the page, with rel=“me”, AND the main domain of your web­site must be lis­ted on your google pro­file links.

I achieved this with the Mys­tique theme with a series of modi­fic­a­tions.

首先, I added the code from yoast (as shown below) to functions.php

第二, I went to my word­press pro­file page and filled in the google pro­file field with a link to my google pro­file

Third, I edited a line to author.php, 再次, based on inform­a­tion from yoast, but changed for the Mys­tique theme

in this sec­tion

add this extra line

下一个, I edited single.php to add rel=“author” to the link to my author page. In the Mys­tique theme this is found towards the bot­tom of the file, with­in the (long) 线(s) as shown below. I have added the rel=“author” at the end of the first line before the href=” part

Then, finally add the same rel=“author” to line 670 of core.php

When this is cor­rectly imple­men­ted you should get a suc­cess mes­sage in the snip­pets test­ing tool which reads Veri­fied: Author­ship markup is cor­rect for this page

2. The second problem(s) were with the hfeed / hentry sec­tion and included the fol­low­ing:

小姐-ING需要的hCard“作者”.
警告,ing: 至少一个字段必须为hCard的设置.
警告,ing: 至少有一个字段必须为帽邻mEntry设置.
警告,ing: 小姐-ING必填字段“入门称号”.
警告,ing: 小姐-ING必填字段“更新”.
警告,ing: 小姐-ING需要的hCard“作者”.

The solution(s):

Use the word­press edit­or to edit single.php

Find the code

replace this with…

A final note — Don’t just copy and paste the code from this page, as for some reas­on (I’m guess­ing char­ac­ter encod­ing) it wont work. Copy it from here and paste into win­dows note­pad. Then re-copy it from win­dows note­pad (or any oth­er basic plain-text-only edit­or) and paste into the word­press edit­or. Going via note­pad loses any hid­den encod­ing or oth­er data which causes a prob­lem so the code is treated as the plain-text it is sup­posed to be

你怎么看? 请给我们一个评论如下! 如果您想订阅,请使用菜单上的订阅链接右上方. 您还可以通过使用下面的链接社会分享这与你的朋友. 干杯.

发表评论