Skip Navigation

[Resolved] Conditionally show "load more" button

This support ticket is created 5 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by Minesh 5 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#1339289

Tell us what you are trying to do?

I have a View displaying the first 6 items but am also using infinite scrolling and a "load more" button that displays up to 6 more items on each click of button. If there are 6 or less the button is hidden. This is working well:

[wpv-conditional if="( '[wpv-found-count]' gt '6' )"]
[wpv-pager-next-page force="true"]<button>[wpml-string context="wpv-views"]Load More[/wpml-string]</button>[/wpv-pager-next-page]
[/wpv-conditional]

However, once all the items are loaded, the "load more" button remains at the bottom - but does nothing.

I need help modifying the above condition so that:

- if there are 6 items or less the button is hidden;
- if there are items not yet displayed on the page (i.e. more than 6), the button is shown;
- if all the items are shown the button is hidden.

or put more simply: if there are any items not being displayed, the button is shown, else it is hidden.

I am not sure how to do this.

Thank you again

#1339579

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share edit view screenshot of your view so I can able to reivew where exactly you placed the [wpv-conditional] shortcode.

#1339935
screenshot-project-edit-view (1).jpg

screenshot attached

thank you

#1340517

Does this screenshot give you what you needed to respond? From your reply it sounds like there is indeed a solution, yes?

thank you again

#1340985

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok - I checked and found that pagination shortcodes are not hooked in when infinite scroll is fired using the "Load more" button which is setup using [wpv-pager-next-page] shortcode.

We already added this as a feature request and "Load more" button feature is set to be added to Views version 3.1 which should be out in near future. Please note that there is no ETA on it.