I have a view that shows the latest 4 posts by an author, using a limit of 4 posts.
Beneath the 4 posts, I have a link that says, "click here for more posts" which leads to a page where an unlimited (infinite scroller) list of the author's posts appear.
All this works fine.
My question is this: How do I make a conditional so that the "click here for more posts" link only shows up if the author has more than 4 posts available?
I'm stuck because I can't rely on [wpv-post-count] -- because that will always be 4 even if the author has 1,000 posts since I've limited the query to showing just 4.
Thanks for any suggestions. I might be thinking about this the wrong way.
Languages: English (English )Chinese (Simplified) (简体中文 )
Timezone: Asia/Hong_Kong (GMT+08:00)
Dear canton,
How do you setup the "click here for more posts" link?
If you use the build-in feature infinite-scrolling of Views plugin, you will need to setup the option "Limit and Offset" as "No limit", and follow our document:
Infinite Scrolling for WordPress Content https://toolset.com/documentation/user-guides/infinite-scrolling-in-views/
Sorry, I don't think my question was well expressed (or well understood).
I already know how to do infinite views.
My question is when I have a non-infinite view that only shows 4 items, what's a display option or a conditional that will allow me work with the total number of items that *could* have been displayed, had I not set a limit?
My page currently shows only the first 4 items.
I want to make a conditional that shows a "More" link (and links out to a totally different view I've made) only if more than 4 items are *possible* given all the other filters that have been set besides the limit.
How about setting query limit = 5 and pagination = 4 and then add a [wpv-conditional ...] after the [wpv-layout-meta-html] which has whatever action/code you want to do when found-count is > 4?
Wow, it looks like I have two options here, yours and Bob's.
I think I'll try Bob's first -- that makes a lot of sense. Thanks Bob!
Luo, just to makes sure I understand your solution which sounds like a generally interesting way around problems:
I can create a view whose ONLY output is merely the [wpv-found-count] of some query, and then in my main view, I invoke that other view within a conditional. Is that right?