menu

arrow_back How to display fresh entries in WordPress by minus a certain number of entries from the loop?

by
1 vote
Good time, everyone.
There is such a task:
Need to display the most recent entries on the main page, but the records need to be output minus, for example, the last 5 records. That is, starting from the 6th record by date of publication.
Let's say we have 10 records, we need to output records starting from 5 records.
In WordPress there is a loop output with which I output a given amount:
<?php
global $post;
$args = array( 'numberposts' => 6 , 'orderby' => 'date');
$myposts = get_posts( $args );
foreach( $myposts as $post ){ setup_postdata($post);
?>
<div class="col-md-6 blog-items">
<div class="blog-item">
<div class="blog-item__pic">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('large'); ?></a>
</div>
<div class="blog-item__con">
<div class="blog-item__date">
<?php echo get_the_date('j F Y'); ?>
</div>
<div class="blog-item__title">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</div>
</div>
</div>
</div>

<?php
}
wp_reset_postdata();
?>
This is the loop where you have to write the PHP parameters to output. I'm waiting for your help.

1 Answer

by
 
Best answer
0 votes