更新日を表示させたい

WordPressの記事に「最終更新日」を表示する方法
http://netaone.com/wp/wordpress-modified-date/

Surfaramaでもcontent-single.phpにget_the_timeの記述あり。投稿のループ内というのが私には理解できてない。あと、全ッ然読めない。

PHPは「<?php」 で始まって「?>」で終わるのがひとつの命令文のようなので、それらしい箇所をメモとして抜き出してみます。

<?php
//first get the current category ID
$categories = get_the_category($post->ID);
$cat_id = $categories[0]->cat_ID;
//then i get the data from the database
$cat_data = get_option(“taxonomy_$cat_id”);
//and then i just display my category image if it exists
if (isset($cat_data[‘cat_color’])){
$cat_color_write = ‘ style=”background-color: ‘. $cat_data[‘cat_color’] .'”‘;
} else {
$cat_color_write = ”;
}
printf( __( ‘<span class=”sep meta-by”%8$s>Author </span> <span class=”author vcard”><a class=”url fn n” href=”%5$s” title=”%6$s” rel=”author”>%7$s</a></span><span class=”byline”> <span class=”sep meta-on”%8$s> Date </span> <a href=”%1$s” title=”%2$s” rel=”bookmark”><time class=”entry-date” datetime=”%3$s”>%4$s</time></a></span>’, ‘surfarama’ ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( ‘c’ ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( ‘ID’ ) ) ),
esc_attr( sprintf( __( ‘View all posts by %s’, ‘surfarama’ ), get_the_author() ) ),
esc_html( get_the_author() ),
$cat_color_write
);
?>

実際のページの変えたいとこでいうと、ソースのこの部分なのかなぁ。

<div class=”entry-meta clearfix”>
<span class=”sep meta-by” style=”background-color: #a3bce2″>Author </span> <span class=”author vcard”><a class=”url fn n” href=”http://www.229n.com/blog/author/ura_2/” title=”View all posts by ura_2″ rel=”author”>ura_2</a></span><span class=”byline”> <span class=”sep meta-on” style=”background-color: #a3bce2″> Date </span> <a href=”http://www.229n.com/blog/2016/05/%e3%82%a6%e3%82%a3%e3%82%b8%e3%82%a7%e3%83%83%e3%83%88%e3%82%92%e3%81%84%e3%81%98%e3%82%8b/” title=”1:22 PM” rel=”bookmark”><time class=”entry-date” datetime=”2016-05-25T13:22:11+00:00″>2016年5月25日</time></a></span> </div>

0525更新日↑これを変えたい

タイトルとURLをコピーしました