Support » Plugins and Hacks » configuring the timestamp within a plugin’s function

configuring the timestamp within a plugin’s function

  • I’m developing a widget for WP-Dash that will display all upcoming concerts (the scheduled entries div from the existing dashboard) and need help configuring the timestamp.

    Here is the main output code:
    $output .= "<li><a href='post.php?action=edit&amp;post=$post->ID' title='edit this post'>$post->post_title</a> on $post->post_date </li>";
    For now I have the $post->post_date because it has been the only thing to actually work. I would like to be able to configure it to display as a php date format such as ('m/d/Y')

Viewing 5 replies - 1 through 5 (of 5 total)
  • If you do …
    setup_postdata( $post )
    ..beforehand, you could, then do…
    the_date( 'm/d/Y' )

    Would date('m/d/y', $post->post_date); not work?

    And a lot easier solution to this is to just make a copy of the “Recent Posts” widget (dashboard-recent-posts.php) and edit the post query to something like:

    SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt > '$today' ORDER BY post_date ASC LIMIT 10

    That’ll list out up to the 10 soonest posts from the future with the soonest first.

    Then just change the function names and the make_widget_available part at the bottom and you’re good to go.

    Thanks for the replies, I’ll try in the morning. @viper – i’m looking to display the date as well as sort by it so the second part is already taken care of.


    That is ordered by date and adding the date would be easy, but whatever. 🙂

    Sorry – long night last night… I meant that the upcoming posts are already sorted, and just need timestamps per each. With the date() function, the timestamps for each are 12/31/1969.

    Code with the_time()http://paste.uni.cc/7556
    Code with date()http://paste.uni.cc/7555

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘configuring the timestamp within a plugin’s function’ is closed to new replies.