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

  • Home
  • SEARCH
  • 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 am trying to work with jQuery UI tabs in WordPress but I keep
note: I'm working on wordpress but this isn't a wordpress question. I have a
I'm working on a WordPress CMS site and I want to add my own
In the WordPress core code is a rule to auto-create title= attributes for links
I'm a freelancer and prefer working on large projects all by my own self.
I'm trying ajax for the first time but it doesn't work. This is some.php
I do NOT intend to implement all the wp_post features. The thing am interested
In response to the announcement that WordPress 3.2 (due later this month) will require
i have a problem with running my jQuery scripts in Internet Explorer at my
I used to have a jCarousel of image that worked perfectly fine in the

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.