Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3619840
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:55:45+00:00 2026-05-18T22:55:45+00:00

I am working with WordPress, and trying to get the information from all the

  • 0

I am working with WordPress, and trying to get the information from all the posts created the current day. My code currently looks like this:

        $today = getdate();
 $posts = get_posts('year=' .$today["year"] .'&monthnum=' .$today["mon"] .'&day=' .$today["mday"] );

 $CurrentPost = array($posts[0]);

 $Post_Date = $CurrentPost[post_date];
 echo "Post Date: $Post_Date ";

However, I am getting NULL for Post Date. Am I accessing the data structure correctly? I know that there is data there, because when I do a print_r on the $posts array, I get the following:

Array ( [0] => stdClass Object ( [ID] => 4 [post_author] => 1 [post_date] => 2011-01-01 02:59:09 [post_date_gmt] => 2011-01-01 02:59:09 [post_content] => This Post created Friday December 31st, 2010 [post_title] => Test Post 1 [post_excerpt] => [post_status] => publish [comment_status] => open [ping_status] => open [post_password] => [post_name] => test-post-1 [to_ping] => [pinged] => [post_modified] => 2011-01-01 02:59:09 [post_modified_gmt] => 2011-01-01 02:59:09 [post_content_filtered] => [post_parent] => 0 [guid] => http://localhost/wordpress/?p=4 [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 0 [filter] => raw ) [1] => stdClass Object ( [ID] => 1 [post_author] => 1 [post_date] => 2011-01-01 02:43:02 [post_date_gmt] => 2011-01-01 02:43:02 [post_content] => Welcome to WordPress. This is your first post. Edit or delete it, then start blogging! [post_title] => Hello world! [post_excerpt] => [post_status] => publish [comment_status] => open [ping_status] => open [post_password] => [post_name] => hello-world [to_ping] => [pinged] => [post_modified] => 2011-01-01 02:43:02 [post_modified_gmt] => 2011-01-01 02:43:02 [post_content_filtered] => [post_parent] => 0 [guid] => http://localhost/wordpress/?p=1 [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 1 [filter] => raw ) )

I would like to be able to just access each element in each post directly as if calling it from an array so I can generate a non-html output of the posts written the current day. Any advice would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T22:55:46+00:00Added an answer on May 18, 2026 at 10:55 pm

    Edited:
    So I tried this out. Both of these work for me:

    
    echo "Post Date 1: " .$posts[0]->post_date . "<br/>";
    echo "Post Date 2: " . mysql2date('M j Y', $posts[0]->post_date);
    
    

    Here is my output:

    
    Post Date 1: 2011-01-01 01:45:40
    Post Date 2: Jan 1 2011
    
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to setup a loop in Wordpress that will show all posts from
I am trying to get Wordpress 3.3.1 multisite (sub-domains) working in my localhost. However,
I am trying to get wordpress to pull an ID from a variable to
I'm working on a site trying to get a popular posts section on it.
Trying to get Galleria script working in WordPress? I am have enqueued the script
I'm trying to get the Thesis theme working in Wordpress, and it's almost perfect.
Well I am working with wordpress and I'm trying to sort some posts by
I'm a newbie in WordPress. I'm trying to read information from a custom table
I'm working on a wordpress site, with a blog post that ends like: http://www.blog.com/?p=2
I'm trying to make a page for use with wordpress and it's almost working,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.