我有疑问:
<?php
$args = array( \'post_type\' => \'post\',
\'post_status\' => \'publish\',
\'orderby\' => \'post_date\',
\'order\' => \'DESC\',
\'showposts\' => 10
);
$recent = new WP_Query($args);
$TopnewsIndex1 = 0;
while($recent->have_posts()) : $recent->the_post();
array_push($index_posts, $recent->post->ID);
$ptitle = esc_attr( get_post_field( \'post_title\', $post_id ));
$pdesc = esc_attr( get_post_field( \'sub_desc\', $post_id ));
?>
<h2> <a href=\'<?php the_permalink() ?>\' rel=\'bookmark\'> <?php echo $ptitle ?></a> </h2>
<p><?php echo $pdesc; ?></p>
<?php endwhile; ?>
然后get\\u num\\u querys()=1个查询(用于10篇文章)
如果我习惯于为每个帖子显示拇指图像,我会添加字符串:
<?php echo the_post_thumbnail( \'medium\' ); ?>
然后get\\u num\\u querys()=21个查询(1+10*2)
如果在一个页面中,我习惯用拇指显示50篇文章,那么num querys=101个查询!!!
你知道为什么吗?如何优化此代码?