WordPress.org

Forums

Why won't my date conform to what I have set in "options" (2 posts)

  1. buskerdog
    Member
    Posted 8 years ago #

    I'm trying to add the date to my wp_get_archives generated list. (the page is here: http://tinyurl.com/ze6xd ) I'm monkeying around with the template-functions-general.php file and edited the "post-by-post" section to be the following:

    } elseif ( 'postbypost' == $type ) {

    $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_date < '$now' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);

    if ( $arcresults ) {
    foreach ( $arcresults as $arcresult ) {
    if ( $arcresult->post_date != '0000-00-00 00:00:00' ) {

    $date = $arcresult->post_date;

    $url = get_permalink($arcresult);
    $arc_title = $arcresult->post_title;
    if ( $arc_title )
    $text = strip_tags($arc_title, $date);
    else
    $text = $arcresult->post_title . "title";
    echo get_archives_link($url, $text . " (" . $date . ")", $format, $before, $after);

    However, $date gives me a full timestamp like this: 2006-08-24 16:03:22

    I have the date format override turned off. What can I do to capture the date for each entry and display it like January 1, 2006?

  2. buskerdog
    Member
    Posted 8 years ago #

    I haven't solved this. I did however figure out how to truncate the time off it with substr($date, 0, -9) but the date still shows as 2006-08-24 which isn't what I want. Any thoughts.

Topic Closed

This topic has been closed to new replies.

About this Topic