Displaying Posts
-
I can display my posts using the following code:
<?php global $post; $mpyposts = get_posts('numberposts=2&category=6'); foreach ($mpyposts as $post): setup_postdata($post); ?> <?php //to check against expiration date; $currentdate = date("Ymd"); $expirationdate = get_post_custom_values('expiration'); if (is_null($expirationdate)) { $expirestring = '30005050'; //MAKE UN-EXPIRING POSTS ALWAYS SHOW UP; } else { if (is_array($expirationdate)) { $expirestringarray = implode($expirationdate); } $expirestring = str_replace("/","",$expirestringarray); } //else if ( $expirestring > $currentdate ) { ?> <ul class="posts"> <?php the_content(); ?> </ul> <?php } //end if for expiration; ?> <?php endforeach; ?>
however I want to display them in the reverse order (most recent at bottom), so I change
$mpyposts = get_posts('numberposts=2&category=6');
to
$mpyposts = get_posts('numberposts=2&category=6&order=ASC');
and everything disappears completely. What can I do to get it to work correctly?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Displaying Posts’ is closed to new replies.