我爲WordPress創建了一個單獨的插件(通常稱爲特定於站點的插件),我添加了一個函數來顯示上次修改日期和時間。那麼,它運作良好,但我不想顯示相同的頁面,但只爲郵政。如何防止 - 上次修改日期/時間 - 不顯示在頁面上,但只顯示帖子
我應該在這段代碼中修改什麼?
function wpb_last_updated_date($content) {
$u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 86400) {
$updated_date = get_the_modified_time('F jS, Y');
$updated_time = get_the_modified_time('h:i a');
$custom_content .= '<p class="last-updated"><b>Last updated on</b> '. $updated_date . ' at '. $updated_time .'</p>';
}
$custom_content .= $content;
return $custom_content;
}
add_filter('the_content', 'wpb_last_updated_date');
它運作了Ankita!萬分感謝! – ankush