0Day Forums
How can I skip the first post in WordPress? - Printable Version

+- 0Day Forums (https://zeroday.vip)
+-- Forum: Coding (https://zeroday.vip/Forum-Coding)
+--- Forum: CMS (https://zeroday.vip/Forum-CMS)
+---- Forum: WordPress (https://zeroday.vip/Forum-WordPress)
+---- Thread: How can I skip the first post in WordPress? (/Thread-How-can-I-skip-the-first-post-in-WordPress)



How can I skip the first post in WordPress? - intercourse929 - 07-27-2023

How can I skip the first post in WordPress?

<?php
$recentPosts = new WP_Query();
$recentPosts->query(array('showposts' => 6,'post_type' =>array('stiri')));
?>
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>



RE: How can I skip the first post in WordPress? - completion508 - 07-27-2023

Use the [`offset`](

[To see links please register here]

) parameter:

<?php
$recentPosts = new WP_Query( 'offset=1' ) );
$recentPosts->query(array('showposts' => 6,'post_type' =>array('stiri')));
?>
<?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>





RE: How can I skip the first post in WordPress? - bankable842 - 07-27-2023

Use the **offset**

$recentPosts = new WP_Query (
array(
'post_type' => 'stiri',
'post_status' => 'publish',
'posts_per_page' => 6, // all = -1
'orderby' => 'date',
'order' => 'DESC',
'offset' => 1
)
);