admin管理员组文章数量:1316974
If I understand well there is already include in wp /general-template.php
, and this should include the function to display the updated date (I still want the original date).
I found this:
if ( !function_exists( 'get_the_modified_time' ) ) {
require_once ABSPATH . WPINC . '/general-template.php';
}
$d = '';
// Optional. Post ID or WP_Post object. Default current post.
$post = null;
// NOTICE! Understand what this does before running.
$result = get_the_modified_time($d, $post);
So I tried to paste this piece of code in the template's content.php
:
article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php
if ( is_sticky() && is_home() ) :
echo twentyseventeen_get_svg( array( 'icon' => 'thumb-tack' ) );
endif;
?>
<header class="entry-header">
<?php
if ( 'post' === get_post_type() ) {
echo '<div class="entry-meta">';
if ( is_single() ) {
twentyseventeen_posted_on();
} else {
echo twentyseventeen_time_link();
twentyseventeen_edit_link();
};
echo '</div><!-- .entry-meta -->';
};
if ( is_single() ) {
the_title( '<h1 class="entry-title">', '</h1>' );
} elseif ( is_front_page() && is_home() ) {
the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' );
} else {
the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' );
}
?>
<?php
if ( !function_exists( 'get_the_modified_time' ) ) {
require_once ABSPATH . WPINC . '/general-template.php';
}
$d = '';
// Optional. Post ID or WP_Post object. Default current post.
$post = null;
// NOTICE! Understand what this does before running.
$result = get_the_modified_time($d, $post);
?>
The only result I get is a blank page with only my article title displayed.
Maybe I'm completely wrong. If someone can help me with this problem that will be great.
本文标签:
版权声明:本文标题:How can I display the last updated post with the author, the created date, and the modified date on one line? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742019355a2414376.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论