我需要这个 php 代码来显示最近的帖子。也许是在帖子上显示的 if 语句。有任何想法吗?任何帮助表示赞赏。
$temp = $wp_query; // assign orginal query to temp variable for later use
$wp_query = null;
$wp_query = new WP_Query($args);
if( have_posts() ) :
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
<a href="<?php the_permalink() ?>" <?php post_class() ?> id="post-<?php the_ID(); ?>">
<?php the_post_thumbnail("events-thumb"); ?>
<h3><?php the_title(); ?></h3>
<p><?php echo nl2br(get_post_meta($post->ID, 'proj_address', true)); ?></p>
<span></span>
<div style="clear:both;"></div>
</a>
<?php endwhile; ?>
<?php
endif;
$wp_query = $temp; //reset back to original query
?>