Forum
Blog template that excludes most recent post
Hi Guys,
I have a requirement for a blog post list page where the most recent blog post is large a covers the full-width of the top of the page and then the next 8 most recent sit in two rows of 4 beneath this.
I can achieve the layout using two perch_blog_custom calls and two templates, then by sorting the date and number of returned items. The part i'm stuck on is how to prevent the second perch_blog_custom call also returning the 1st result, it needs to return the 2nd - 9th most recent post.
is this possible?
Set
'start'=>2
on the second instance.I can't get this to work, this is the code i'm using:
What is happening, or not happening when you say it isn't working? What result do you expect and what are you seeing?
It's still returning the first post, I have two perch_blog_custom calls:
and
The first should just show the most recent blog post and the second should show all except the most recent. The reason behind this is the designs for the blog have the most recent blog post much larger than the rest so the best way I know to do this was with two templates
The problem I am seeing here is you sort the second call, and not the first call. Maybe this is changing the output order. ??
You may need to turn pagination off with the
paginate
option.Ok So there was a problem with the sort order on the first call, I hadn't noticed but the first call was showing the oldest not the newest so adding the sort order to both has fixed that.
Still having the issue with the second call still showing all the posts and not excluding the first,
Here is the blog page is it's any help: https://calltrain.de22.co.uk/blog/archive.php?cat=blog
What does your code look like now?
Here's the first call:
and the second
When I add paginate to the second it only returns one result and its still the most recent
Try:
Great that works!
I've had to set the count to 100 so it shows more than 10 posts but setting the count (along with paginate) made it work, I had tried both things individually but not together
Thanks
Hi,
Sorry to open up old cases, but I don't think this quite answers the bigger picture - what if I want to exclude the first result (with start => 2) AND use pagination?
Do I have to do it manually?
Hi,
Its a little bit of a faff - but it occurred to me I could just get the ID of the first/most recent blog separately, then do an NEQ filter against the postID in my paginated blog_custom function - I'm guessing this is the best way to achieve what I want?
Thanks
If your in need of additional help I suggest you start a new thread as this is a closed thread which will likely go unanswered due to age, and not being the original poster.