WordPress loop: exclude if it is the latest post

admin2025-06-04  2

I do not want to show the latest post on a particular page. I am using a loop per category as I require these loops on various pages.

So the thing is, I am running 3 separate loops for each category, so I cannot use 'offset' => '1' on each loop as the latest post won't always be in all the categories.

I am using 'orderby' => 'menu_order', so I need a rule that says "show posts unless the post's menu order is 1"

I do not want to show the latest post on a particular page. I am using a loop per category as I require these loops on various pages.

So the thing is, I am running 3 separate loops for each category, so I cannot use 'offset' => '1' on each loop as the latest post won't always be in all the categories.

I am using 'orderby' => 'menu_order', so I need a rule that says "show posts unless the post's menu order is 1"

Share Improve this question edited Jan 24, 2019 at 18:31 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Jan 24, 2019 at 17:22 Sony ThePonySony ThePony 1313 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

If you create your own queries for these loops, all you have to do is to use post__not_in param in these queries.

This way you will exclude given post from these loops.

And to get the ID of first post, just use get_posts with 'fields' => 'ids'

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748977207a315322.html

最新回复(0)