0
ThemeKraftシンプルテーマ(Wordpress)の_tk_posted_on()関数に問題があります。 私はbegginer私が言うんだけど、私はコードの一部を支援する必要があります。_tk_posted_on() - 年ではなく日付全体
function _tk_posted_on() {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
$time_string = sprintf($time_string,
esc_attr(get_the_date('c')),
esc_html(get_the_date())
);
$time_string = sprintf('<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
esc_url(get_permalink()),
esc_attr(get_the_time()),
$time_string
);
if (get_the_time('U') !== get_the_modified_time('U')){
$time_string_update = '<time class="updated" datetime="%1$s">%2$s</time>';
$time_string_update = sprintf($time_string_update,
esc_attr(get_the_modified_date('c')),
esc_html(get_the_modified_date())
);
$time_string_update = sprintf('<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>',
esc_url(get_permalink()),
esc_attr(get_the_time()),
$time_string_update
);
$time_string .= __(', updated on ', '_tk') . $time_string_update;
}
printf(__('<span class="posted-on">Posted on %1$s</span>', '_tk'),
$time_string,
sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
esc_url(get_author_posts_url(get_the_author_meta('ID'))),
esc_attr(sprintf(__('View all posts by %s', '_tk'), get_the_author())),
esc_html(get_the_author())
)
);}
それは全体の日付をポストやポストを公開し、誰、私は年だけを投稿し、それをしたい..私が試した編集それ..しかし、私は...助けを おかげで、それを解決することはできません:)
を表示していますが、これを試みることができます。私は 'esc_attr(get_the_date( 'c'))'で、cは日付を表示する方法の指定子であると思います。あなたの時間はこのようになりますか(\t 2004-02-12T15:19:21 + 00:00)?あなたは指定子「Y」を探していると思います。 'c'を' Y'で置き換えるだけで問題を解決できるでしょう。このウェブサイトには、どのようなフォーマットがあるかについての情報があります。 (https://codex.wordpress.org/Formatting_Date_and_Time)。 PS。私は100%ワードプレスのnoob(初心者でもない)であるので、私はこれを答えとして掲示しなかった。それがうまくいくなら、私はこれを答えに入れます。 – BramMooij
私はそれを助けてくれたおかげで、自分で解決しました。 – s4ddly
良いです。同じ問題を抱えている誰かがそれから学ぶことができるように解答として投稿してください。 – BramMooij