Comments Pujiang started the conversationAugust 7, 2016 at 12:57amHow to display recent 3 posts in homepage by the style of news-large ?<div id="blog" class="full"> <?php $squares_paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; $squares_args = array( 'post_type' => 'post', 'paged' => $squares_paged ); $squares_posts_query = new WP_Query( $squares_args ); // the loop while( $squares_posts_query->have_posts() ){ $squares_posts_query->the_post(); get_template_part( 'sections/blog_post_section' ); } ?> <!-- /Blog --> 1,974Support repliedAugust 8, 2016 at 2:46pmHellotry<div id="blog" class="full"> <?php $squares_paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; $squares_args = array( 'post_type' => 'post', 'posts_per_page' => 3, 'paged' => $squares_paged ); $squares_posts_query = new WP_Query( $squares_args ); // the loop $posts_no = 1; while( $squares_posts_query->have_posts() ){ if( $posts_no == 3 ){ break; } $squares_posts_query->the_post(); get_template_part( 'sections/blog_post_section' ); $posts_no++; } ?> <!-- /Blog -->Thank you. Clapat Support https://www.clapat.com/ Review Envato Item Support Policy Sign in to reply ...
How to display recent 3 posts in homepage by the style of news-large ?
<div id="blog" class="full">
<?php
$squares_paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
$squares_args = array(
'post_type' => 'post',
'paged' => $squares_paged
);
$squares_posts_query = new WP_Query( $squares_args );
// the loop
while( $squares_posts_query->have_posts() ){
$squares_posts_query->the_post();
get_template_part( 'sections/blog_post_section' );
}
?>
<!-- /Blog -->
Hello
try
<div id="blog" class="full">
<?php
$squares_paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
$squares_args = array( 'post_type' => 'post', 'posts_per_page' => 3, 'paged' => $squares_paged );
$squares_posts_query = new WP_Query( $squares_args );
// the loop
$posts_no = 1;
while( $squares_posts_query->have_posts() ){
if( $posts_no == 3 ){
break;
}
$squares_posts_query->the_post();
get_template_part( 'sections/blog_post_section' );
$posts_no++;
}
?>
<!-- /Blog -->
Thank you.
Clapat Support
https://www.clapat.com/
Review Envato Item Support Policy