我制作了一个自定义博客页面,希望该页面仅显示具有博客类别的帖子。我没有尝试过任何工作。我希望博客类别的帖子从顶部显示最新,而从底部显示最早。
<div class="two-thirds">
<?php // Display blog posts on any page @ https://m0n.co/l
$temp = $wp_query; $wp_query= null;
$wp_query = new WP_Query( array( 'category_name' => 'blog' )); $wp_query->query('posts_per_page=3' . '&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div class="third"><a class="blog-image" href="<?php the_permalink(); ?>"><?php the_post_thumbnail( array(200,220) ); ?></a></div>
<div class="two-thirds blog-text">
<h3 class="blog-title"><a href="<?php the_permalink(); ?>" title="Read more"><?php the_title(); ?></a></h3>
<span class="blog-meta"><i class="fa fa-calendar-o blog-icon2"></i><?php echo get_the_date(); ?> <i class="fa fa-comment blog-icon2"></i><?php comments_number(); ?></span>
<?php the_excerpt(""); ?><a href="<?php the_permalink(); ?>" title="Read more">Read more</a>
</div>
<?php endwhile; ?>
<?php if ($paged > 1) { ?>
</div>