Support » Fixing WordPress » Show post date

  • Resolved aled2305


    Hello, I’m using

    ?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        // Fetch most recent posts, limit to 1
    		$latest_posts = get_posts( array(
    			'posts_per_page' => 1,
    		) );
        // get first and only item in array
    		$latest_post  = $latest_posts[0];
    	<div class="Ptitle"><h1><a href="<?php echo get_permalink( $latest_post->ID ); ?>"><?php echo $latest_post->post_title; ?></a></h1><h3><span class="entry-date"><?php echo get_the_date(); ?></span></h3></div>
       	<?php if ( has_excerpt( $latest_post ) ) : ?>
    	<p><?php echo $latest_post->post_excerpt; ?></p>
    	  <?php else : ?>
    	  <?php echo strip_shortcodes(wp_trim_words( $latest_post->post_content, 50 )); // '250' is number of words ?>
    	  <?php endif; ?>
    	<p><a href="<?php echo get_permalink( $latest_post->ID ); ?>"> Read More...</a></p>

    at the moment to show the most resent post and in the code I use
    <span class="entry-date"><?php echo get_the_date(); ?></span>
    to show the post date, but it says 23 of Oct even though it was posted today (29 of Oct) and on the edit post page it says 29?

    Can someone please help me resolve this! and look here if you’ve got time too.


  • The topic ‘Show post date’ is closed to new replies.