How to get wordpress three latest posts in your custom template?

Woocoders
Woocoders
2nd September 2020
query_posts('post_type=post&posts_per_page=3&orderby=date&order=desc');
while ( have_posts() ) : the_post();
    echo '<table>
                                                <tr>
                                                                <td rowspan="2" height="200" width="200"></td>
                                                                <td><h2>';
                the_title();
                echo '</h2></td>
                                                </tr>
                                                <tr>
                                                                <td>';
                if ( has_post_thumbnail() ) {
                               
                  the_post_thumbnail(array(200,200));
                  echo '</td><td style="vertical-align: top;padding-left: 10px;">';
                }
                the_content();
                echo '</td>
                                                </tr>
                                </table>';
endwhile;

// Reset Query
wp_reset_query();

/* end */

Share this post: