2015-10-07 46 views
0

我打算将一些Rich Snippet代码添加到我的Wordpress网站。不幸的是,当我在Wordpress中编写这些代码时,我并不是一个真正的专业人士。我找不到像我这样的初学者的好教程。有人可以通过添加代码告诉我如何在主页和其他页面上设置Rich Snippets吗?Rich Snippet编码WordPress插件

请告诉我必须在哪里应用代码,以及它是如何工作的。

PS:我不想使用插件!也许我会编写我自己的插件,但我不会使用可用的插件,因为我已经尝试过了,我对这些插件不满意。

所以,我知道一些PHP和HTML + CSS。别担心。

回答

0

丰富的代码片段是由搜索引擎生成的,它会提取您在主题中实现的微数据模式。

你需要编辑你的主题,并实现你想实现的任何Schema。如果它是例如产品。您需要按照这个模式https://schema.org/Product

<div itemscope itemtype="http://schema.org/Product"> 
    <img itemprop="image" src="dell-30in-lcd.jpg" alt="A Dell UltraSharp monitor"/> 
    <span itemprop="name">Dell UltraSharp 30" LCD Monitor</span> 
    <div itemprop="aggregateRating" 
    itemscope itemtype="http://schema.org/AggregateRating"> 
    <span itemprop="ratingValue">87</span> 
    out of <span itemprop="bestRating">100</span> 
    based on <span itemprop="ratingCount">24</span> user ratings 
    </div> 
    <div itemprop="offers" itemscope itemtype="http://schema.org/AggregateOffer"> 
    <span itemprop="lowPrice">$1250</span> 
    to <span itemprop="highPrice">$1495</span> 
    from <span itemprop="offerCount">8</span> sellers 
    Sellers: 
    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer"> 
     <a itemprop="url" href="save-a-lot-monitors.com/dell-30.html"> 
     Save A Lot Monitors - $1250</a> 
    </div> 
    <div itemprop="offers" itemscope itemtype="http://schema.org/Offer"> 
     <a itemprop="url" href="jondoe-gadgets.com/dell-30.html"> 
     Jon Doe's Gadgets - $1350</a> 
    </div> 
    </div> 
    ... 
</div> 

在HTML中使用的图式模板,你可以将其纳入你的主题,并填充动态内容的网页。

如果上述信息无法帮助您,请询问富含代码段或特定Schema的具体问题。

增加你对公司/组织

对于评论后,我建议同样的方法,但下面的模式为每https://schema.org/Organization

<div itemscope itemtype="http://schema.org/Organization"> 
    <span itemprop="name">Google.org (GOOG)</span> 
Contact Details: 
    <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> 
    Main address: 
     <span itemprop="streetAddress">38 avenue de l'Opera</span> 
     <span itemprop="postalCode">F-75002</span> 
     <span itemprop="addressLocality">Paris, France</span> 
    , 
    </div> 
    Tel:<span itemprop="telephone">(33 1) 42 68 53 00 </span>, 
    Fax:<span itemprop="faxNumber">(33 1) 42 68 53 01 </span>, 
    E-mail: <span itemprop="email">secretariat(at)google.org</span> 
Members: 
- National Scientific Members in 100 countries and territories: Country1, Country2, ... 
- Scientific Union Members, 30 organizations listed in this Yearbook: 
    <span itemprop="member" itemscope itemtype="http://schema.org/Organization"> 
    Member1 
    </span>, 
    <span itemprop="member" itemscope itemtype="http://schema.org/Organization"> 
    Member2 
    </span>, 
History: 
</div> 
+0

这是一个很好的主意。我会尽量以应用理念。这不是关于产品,而是关于组织信息,社交媒体,标识和类似的东西。但我已经知道如何做到这一点。感谢您的支持!如果你的答案通过了,我会保持你的发布:-) – Ben

+0

当然!很高兴你在正确的道路:) – Mohsin

+0

更新的答案与组织架构 – Mohsin