Forum
Minimum number of items before displaying
Hi, me again!
Using perch_blog_custom()
is there a way of setting a minimum number of blog posts before the posts will display?
So for example, I've got staff profile pages that display the blog articles that have been written by them but I want to set a minimum number so that the row of posts only show if there are 4 posts or more.
I hope that makes sense?
Many thanks
Yes, use both
skip-template
andreturn-html
. If the number of items returned in more than 4, then echo the HTML value.Thanks Drew.
I've now got the following but nothing is displaying / outputting.
...I've never worked with
skip-template
orreturn-html
before so how would I echo the html when there are 4 or more posts please?Thank you
Hi Glen,
You would need to do something like this
Thank you Dexter.
I've now got the following but all html / content on the page from this point onwards now stops. Eg the footer is now not showing.
...knowing me it's probably something really simple and obvious
Hello Glen,
I think it should be
PerchUtil::count($posts) > 3
, otherwise Dexter's solution is spot on.That's it
Thank you, everyone - great teamwork!
Glen
Yes sorry, typo on my part