Archive page: display post #6 to #20

by JDRay   Last Updated September 19, 2018 09:08 AM

My client shows his 5 most recent posts (excerpts) on the homepage followed by a "read more" link. On the linked archive page he does not want to display the 5 most recent post again but post #6 to post #20. How can I do this?



Answers 1


add key offset in the query and give value as 5 so the first 5 will be skipped. follow the example below

$custom_args = array('post_type' => 'video',
'posts_per_page' => '-1',
'orderby' => 'id',
'offset'=>5,
'order' => 'ASC',);
$custom_query = get_posts($custom_args);
 foreach ($custom_query as $value) {
 //your data
  }
Adarsh
Adarsh
September 19, 2018 09:07 AM

Related Questions



Sort posts by tags in category pages

Updated June 04, 2016 08:03 AM


Order by 3 custom fields in archive Woocomerce list

Updated September 06, 2018 10:08 AM

Add to query for the_content() on single page

Updated June 11, 2017 13:08 PM