I want to display the titles of the post of the same month as the blog post. I tried this ..
<?php $year = the_date('Y')?> <?php $month = the_date('M')?> <?php $theids = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND MONTH(post_date)= '".$month."' AND YEAR(post_date) = '".$year."' ORDER BY post_date ASC"); foreach ($theids as $theid): ?> <?php echo $theid->post_title; ?> <?php endforeach; ?>
but it's returning nothing. How can I make it work? Thanks.