Created
November 26, 2019 09:16
-
-
Save bepatrickdavid/c60a25fdd7596f10623991a56b4dd8b4 to your computer and use it in GitHub Desktop.
WP: [Query] exclude latest post from the wordpress post loop with pagination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; | |
$args = array( | |
'posts_per_page' => 8, | |
'paged' => $paged, | |
'post__not_in' => array($idPostToExlude) ); | |
$the_query = new WP_Query( $args ); | |
if ( $the_query->have_posts() ) : | |
while ( $the_query->have_posts() ) : $the_query->the_post(); | |
//do some stuff | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment