[insert_php]
$args = array(
‘post_type’ => ‘post’, // replace “post” if you want to display different post-type
‘category_name’ => ‘video’, // category slug
‘posts_per_page’ => -1 // show all posts
);
‘post_type’ => ‘post’, // replace “post” if you want to display different post-type
‘category_name’ => ‘video’, // category slug
‘posts_per_page’ => -1 // show all posts
);
// The Query
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
$c = 1; // counter
$bpr = 4; // number of column in each row
while ( $the_query->have_posts() ) : $the_query->the_post();
?>
‘;
$c = 0; // back the counter to 0 if the condition above is true.
}
$c++; // increment counter of 1 until it hits the limit of column of every row.
endwhile;
} else {
// no posts found
_e( ‘
Oops!
‘, ‘rys’ );
_e( ‘
Sorry, seems there are no post at the moment.
‘, ‘rys’ );
}
/* Restore original Post Data */
wp_reset_postdata();
[/insert_php]