2017-10-18 2 views
0

私はワードプレスのブログで自分の記事を変更した時刻を表示したいと思います。 私は、コードを見つけることを試み、そしてここで私はワードプレスのコンテンツに変更時間を追加

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">Updated on'. $updated_date . ' at '. $updated_time .'</p>'; 
} 

$custom_content .= $content; 
return $custom_content; 
} 
add_filter('the_content', 'wpb_last_updated_date'); 

見つけたものが、私は本当に私のテーマにそれを適用する方法がわからない、公表された時間を表示するためのコード1回の私のテーマは

以下のようなものです
<?php if(! empty($mts_options["mts_{$section}_headline_meta_info"]['date'])) { ?> 
<span class="thetime updated"><i class="fa fa-clock-o"></i> Published on <span itemprop="datePublished"><?php the_time(get_option('date_format')); ?></span></span> 
<?php } ?> 

と私は誰にも助けphp..canに新たなんだ、この

<?php if(! empty($mts_options["mts_{$section}_headline_meta_info"]['date'])) { ?> 
<span class="thetime updated"><i class="fa fa-clock-o"></i> Published on <span itemprop="datePublished"><?php the_time(get_option('date_format')); ?></span> Updated on <span itemprop="dateModified"><?php get_the_time(get_option('date_format')); ?></span></span> 
<?php } ?> 

に変更されたコードにTRID? btw im mythemeshopでヨセミテテーマを使用する

答えて

1

最初のコードセット(フィルターフック)は必要ありません。

このような変更された時間をプリントアウト:the_modified_time(get_option('date_format'))

+0

は、それが動作しますが、そんなにありがとう...イェーイ – ChristyJ

関連する問題