I’m trying to alter the template-functions-general.php file to ADD the date to a post-by-post listing but am having a hard time. Here’s what I have so far:
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 = sprintf("%02d-%02d-%d", $arcresult->month, $arcresult->dayofmonth, $arcresult->year);
$url = get_permalink($arcresult);
$arc_title = $arcresult->post_title;
if ( $arc_title )
$text = strip_tags($arc_title, $date);
else
$text = $arcresult->ID . $date;
echo get_archives_link($url, $text . " (" . $date . ")", $format, $before, $after);
}
}
which gives me listings such as:
Post title blah blah blah. (00-00-0)
with all the zeros for the date. How can I use the daily code of
$dateresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS
year, MONTH(post_date) AS
month, DAYOFMONTH(post_date) AS
dayofmonth` FROM $wpdb->posts WHERE post_date < ‘$now’ AND post_date != ‘0000-00-00 00:00:00’ AND post_status = ‘publish’ ORDER BY post_date DESC” . $limit);’
in my script to pull the date for each listing? Thanks in advance!