修復WordPress的Google浩博網頁提要麼正確

近來在運用Google浩博網頁提要測短期工具的時刻,發覺對於默許Wordpress博客,總會有三條不正確信息顯露出來,今日我就紹介一下子,怎麼樣經過改正Wordpress模版文件來修復這些個不正確信息的辦法。

  不正確信息內部實質意義作別是:

  Warning: Missing required field entry-title.

  Warning: Missing required field updated.

  Warning: Missing required hCard author.

  對於entry-title的不正確信息改正辦法是:

  敞開single.php文件,找到大致相似<h1><?php the_title(); ?></h1>一行,將其改正為<h1 class=title entry-title><?php the_title(); ?></h1>(有點模版有可能是h2或其它)

  對於updated的不正確信息改正辦法是:

  敞開single.php文件,找到<?php the_date();?>一行,將其改正為<div class=date updated><?php the_time('F S, Y'); ?></div>

  對於author的不正確信息改正辦法是:

  敞開single.php文件,找到<?php the_author(); ?>一行,將其改正為<span class=vcard author><span class=fn><?php the_author(); ?></span></span>

  額外,在昨日寫的Google浩博網頁提要教程中,有點讀者期望能舉個Wordpress模版改正的例子,下邊就是一個Wordpress模版的例子。

  敞開single.php文件,在合適位添置加如下所述代碼:

<?php
$separator = '&rsaquo;';
$category = get_the_category();
if ($category) {
foreach($category as $category) {
echo '<div itemscope itemtype=http://data-vocabulary.org/Breadcrumb style=display:inline>';
echo $separator . <a href=\.get_category_link($category->term_id).\ itemprop=\url\><span itemprop=\title\>$category->name</span></a>
;
echo '</div>';
}}
?>