Wordpress: Custom loop to sort posts by month... Need help extracting post_content.. wpdb

I am trying writing a loop to display posts by month. It has gone fairly well so far, i just need help extracting the post_content from the DB. I has successfully gotten all of the rest of the post info using wpdb. I have tried post_content just like post_title but it doesn't work.

here is the example page i am working on. http://asg.websolutionshack.com/events/

<div id="events" class="full">`
 <?php 

$months = $wpdb->get_results("SELECT DISTINCT MONTH(post_date) AS month , YEAR(post_date) AS year FROM $wpdb->posts WHERE post_status = 'publish' and post_date <> now() and post_type = 'event' GROUP BY month, year ORDER BY post_date DESC"); $posts = $wpdb->get_results("SELECT id, post_title, post_content, MONTH(post_date) AS month , YEAR(post_date) AS year , DAY(post_date) AS day FROM $wpdb->posts WHERE post_status = 'publish' and post_type = 'event' ORDER BY post_date DESC"); foreach($months as $this_month){ ?>

<div class="month_block">
<h2 class="month"><?php echo date("F", mktime(0, 0, 0, $this_month->month, 1, $this_month->year)); ?> <?php //echo $this_month->year; ?></h2>
<?php for ($i = 0; $i <= count($posts); $i++){?>`

<div class="entry"> 
  <?php if(($this_month->year == $posts[$i]->year)&&($this_month->month == $posts[$i]->month)){?>
  <span><?php echo $posts[$i]->month ?>.<?php echo $posts[$i]->day ?>.<?php echo $posts[$i]->year ?></span><h3><?php echo $posts[$i]->post_title; ?></h3>
   <p><<?php echo $posts[$i]->post_content; ?><a href="<?php echo get_permalink($posts[$i]->id); ?>">Details ></a></p>
  <?php } ?>
</div><!-- entry -->
<?php } ?>
</div><!-- month -->

`

Thank you for any insight you might be able to provide me.

Answers


<?php the_content( $more_link_text, $stripteaser ); ?>

Returns the post content.

More info here. Also take a look at the related thread here.


Need Your Help

Undo drawing in Paint Application

iphone objective-c ios opengl-es undo-redo

I am making a paint application using OpenGl framework and I'm stuck at UNDO/REDO option..

Learn Python the Hard Way Example #43

python

I'm working through LearnPythontheHardWay by Zed Shaw, and I'm stumped.