Show recent post at static page
-
i add this code at functions.php
function my_recent_posts_shortcode($atts){ $q = new WP_Query( array( 'orderby' => 'date', 'posts_per_page' => '4') ); $list = '<table style="width:100%"> <tr>'; while($q->have_posts()) : $q->the_post(); $list .= '<td align="center" width="25%">' . get_the_post_thumbnail($post_id, array( 108, 121)) . '<br />' . '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' . '<br />' . '</td>'; endwhile; wp_reset_query(); return $list . '</tr> </table>'; } add_shortcode('recent-posts', 'my_recent_posts_shortcode');
it works, but how to show 12 post with each cell is 4 post show?
pls help ??
- The topic ‘Show recent post at static page’ is closed to new replies.