I'm using ACF to display a featured post on the front end of my site. I need the date of the post to be displayed as well. Here is my current code:`


ID), full ); // this fetches the featured post's thumbnail. $thumbnail[0] <-- this is the image's URL

        <img src="<?php echo $thumbnail[0]; ?>">
        <h3><a href="<?php echo get_permalink($featured_post->ID); ?>"><?php echo get_the_title($featured_post->ID); ?></a></h3>

        <p><?php echo custom_excerpt($featured_post->post_content, 2000, ''); // this function is defined in functions.php ?></p>


You can use the get_the_time() to get the post time .

<?php get_the_time( $format, $featured_post->ID ); ?>

See the tutorial https://codex.wordpress.org/Function_Reference/get_the_time

  • <?php get_the_date( $format, $featured_post->ID ); ?> Sep 3 '16 at 12:27
  • but how do I change the date format ? Sep 3 '16 at 12:27
  • Ah its in the settings in my wp-admin. Thanks for your help Sep 3 '16 at 12:36
  • Go through this tutorial about date formats - link Sep 3 '16 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.