get post publish date outside the loop in wordpress

get post publish date outside the loop in wordpress

To get post publish date outside the loop in wordpress use the following code.

$all_posts = get_posts(array('numberposts'=>-1, 'post_status'=> 'publish')); //Get all published posts
foreach ($all_posts as $single_post){
    echo get_the_time('Y-m-d', $single_post->ID); //The date is on Y-m-d format
    echo '<br />' ;
}

Hope this code will help you.
Thanks

Get Template Path in WordPress Child Themes

To get the child theme path use this code on your child theme

<?php echo dirname( get_bloginfo('stylesheet_url') ); ?>

Journal – Free wordpress Bootstrap theme

I have lunched a new free WordPress Bootstrap theme.
This theme is packed with features :

  • Using Bootstrap framework
  • Theme option panel
  • Video support
  • Widget ready
  • Language support
  • And best of all free to use

Here is the live theme demo

Download from Github https://github.com/maidulcu/JOURNAL.git