โชว์ 3 post ไม่มีรูป
<?php query_posts( array(
'category_name' => 'news',
'posts_per_page' => 3,
)); ?>
<?php if( have_posts() ): while ( have_posts() ) : the_post(); ?>
<?php the_excerpt(); ?>
<?php endwhile; ?>
<?php else : ?>
<p><?php __('No News'); ?></p>
<?php endif; ?>
<?php
// the query
$the_query = new WP_Query( array(
'category_name' => 'news',
'posts_per_page' => 3,
));
?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php __('No News'); ?></p>
<?php endif; ?>
ref. https://wordpress.stackexchange.com/questions/36453/how-to-display-last-3-posts-recent-posts-in-a-static-page
แล้วคุมด้วย grid