Answer the question
In order to leave comments, you need to log in
How to exclude duplicate posts when selecting WordPress posts?
Otherwise , they are copied to me indefinitely.
If the selection follows the algorithm "for the last week":
<?php
// WP_Query arguments
$last_month_args = array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
// Using the date_query to filter posts from last week
'date_query' => array(
array(
'after' => '1 week ago'
)
)
);
// The Query
$last_month_posts = new WP_Query( $last_month_args );
// The Loop
if ( $last_month_posts->have_posts() ) {
while ( $last_month_posts->have_posts() ) {
$last_month_posts->the_post();
get_template_part('pinbox', get_post_format());
}
} else {
// Если постов нет
}
// Restore original Post Data
wp_reset_postdata();
?>
Answer the question
In order to leave comments, you need to log in
https://wp-kama.ru/function/wp_query
parameter paged
examples:
wordpress.stackexchange.com/questions/120407/how-t...
stackoverflow.com/questions/29595391/how-to-implem...
https ://premium.wpmudev.org/blog/load-posts-ajax/?...
Finally read the documentation.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question