21WordPress的标志丰富的片段代码为论文主题

In response to a query by Darko Kovan­cives on my pre­vi­ous art­icle aboutfix­ing Rich Snip­pets code for the Mys­tique theme we have resolved the same issues with the Thes­is theme. Details of the changes required are below.

Before the file edits you need to carry out vari­ous oth­er changes and tasks

  1. Get a google pro­file (即. a google+ account)
  2. Add the address of your site (e.g. HTTPS://diymediahome.org) to your google+ pro­file, as a pub­lic link
  3. Get your google plus ID and use it in place of mine in file edit num­ber 5 下面
  4. Change a Thes­is set­ting for show­ing author on teas­ers in the options — Thes­is: Design Options: Teas­ers: Teas­er Dis­play Options: Tick “author name”
  5. Change a Thes­is set­ting for link­ing author in options — Thes­is: Design Options: Dis­play Options: Bylines: “Link author names to archives”

Now do the file edits as fol­lows

1. Edit line 151 in content.php to nest the fn span inside a vcard span

2. Edit line 114 in content.php to provide updated date as well as pub­lished date

3. Edit line 81 in teasers.php to include updated date

4. Edit the author href code on line 144 of content.php to add rel=“me”

5. Edit line 308 in content.php to insert google account link

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

发表评论

21 条评论

的gravatar乔恩·斯卡夫

Yes — I’ve had some syn­tax cor­rup­ted by the word­press code edit­or and by a plu­gin. I’ve hope­fully resolved this now and will be double check­ing the code on all posts over the week­end. Sorry about that!

回复
的gravatarTodd

由于乔恩. Bril­liant fix. The Thes­is’ hcard errors cleaned up nicely.
We are hav­ing a related issue which maybe you’ll know the answer for. We have a some cod­ing gen­er­at­ing the hrecipe format­ting and can see the markups when inspect­ing the post ele­ments, but the rich snip­pet tool isn’t pick­ing it up at all. The developer has no prob­lems get­ting picked up on her site and oth­ers she has built out, but for some reas­on it isn’t get­ting picked up on a Thes­is theme.

Don’t know if this is in your round­house, but if you could take a look that would be awe­some.

Here is a post of ours with the markup: Roas­ted Straw­berry Muffin
Here is one of hers with the markup: Apple­sauce Muffins

Thanks again for the pre­vi­ous fix and for any help you can offer.

回复
的gravatarTodd

I figured out the answer. The recipe was wrapped in a block­quote tag. I changed that to a div tag and everything ran through per­fect.

Thanks again on the pre­vi­ous hcard cod­ing.

Ŧ

回复
的gravatar乔恩·斯卡夫

I think you’ve mixed up your rel=“me” and rel=“author” tags a bit

You should only have a single rel=“me” link — from your author page to your google pro­file. every­where else you should have rel=“author” tags. On your homepage each post has a “by Wouter de Jong” link which points (正确地) to your author page ), but you have rel=“me” on these links. It should be rel=“author”

Once you change these rel=“me” links into rel=“author” I think it will all work — as it stands you’ve got mul­tiple rel=“me” links on your author page, most of them back to itself and only 1 (正确地) point­ing to your google pro­file. I think this is con­fus­ing the snip­pet tool

回复
的gravatarSante

乔恩喜, it worked per­fectly — I didn’t include items 4 and 5 from your list as they are not essen­tial to val­id­ate the rich snip­pet and I’m not bet­ting on Google+ just yet so I don’t want to “lit­ter” my themes 🙂

Thanks for the tip 🙂

回复
的gravatararafinshaon

hav­ing trouble @ Jon Scaife i’m not get­ting exactly the same code into content.php file. I’m using thes­is 1.8.2. wait­ing 4 your response.…

回复
的gravatararafinshaon

i did this exactly. after doing this my Author­ship markup got veri­fied but unfor­tu­nately I’m get­ting below errors .

警告,ing: 小姐-ING必填字段“更新”.
警告,ing: 至少一个字段必须为hCard的设置.
警告,ing: Miss­ing required field “name (FN)”.

do i have to wait for few days for crawl­ing?

回复
的gravatar乔恩·斯卡夫

What’s your site address? Which page are you get­ting the errors on? The homepage, a post or both? Have you made any oth­er modi­fic­a­tions to the theme — like adding extra files or using a child theme?

回复
的gravatar乔恩·斯卡夫

Sorry — my fault. I’ve figured it out. The code had got mangled by word­press. I think when I update the post word­press pro­cesses some of the code and takes some of the classes out which makes it dis­func­tion­al. I’ve cor­rec­ted it. Please give it a try now.

回复
的gravatarEko Y

谢谢, very use­ful info. But, how to add meta tags inform­a­tion like this blog? It looks if i do right click in browser » view page info. There are many inform­a­tion on gen­er­al tab. Like Author, View­port Etc. My blog is just con­tain : con­tent, robots, descrip­tions, keywords in page info..How to get this snip­pet?
Thank You..

回复
的gravatar乔恩·斯卡夫

Most of that comes from using a semant­ic HTML5 theme for word­press com­bined with the Yoast PLU-杜松子酒. I also have vari­ous meta files like humans.txt and robots.txt. Have a look at the word­press guide for loads of inform­a­tion about improv­ing your word­press setup.

回复