The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] Show post date (1 post)

  1. aled2305
    Posted 2 years ago #

    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.



Topic Closed

This topic has been closed to new replies.

About this Topic