How can I display the last updated post with the author, the created date, and the modified date on one line?

Question

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.

0
Moto Jero 3 months 0 Answers 12 views 0

Leave an answer