Skip Navigation

[Resolved] Create “load more” button with toolset blocks

This thread is resolved. Here is a description of the problem and solution.

Problem:

How to create a Load More button in Toolset?

Solution:

Legacy Views:

- Create a view with "infinite scroll" feature:
https://toolset.com/documentation/user-guides/infinite-scrolling-in-views/
- In the "Loop Editor" section, insert the next page link shortcode between
[/wpv-items-found] and [wpv-no-items-found], for example:

[/wpv-items-found]
[wpv-pager-next-page force="true"][wpml-string context="wpv-views"]Load More Button here ...[/wpml-string][/wpv-pager-next-page]
    [wpv-no-items-found]

- In the JS Editor add the code below:

(function ($) {
    $(document).ready(function () {
    
        $('.js-wpv-layout-infinite-scrolling').removeClass('js-wpv-layout-infinite-scrolling');
    
    });
})(jQuery);

Views Block:

Add the same items above inside the pagination options in the sidebar of the Views options.

You still will need a shortcode block and add the shortcode mentioned above for the button itself.

Relevant Documentation:

https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-pager-next-page

This support ticket is created 2 years, 1 month 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.

This topic contains 7 replies, has 2 voices.

Last updated by Fred 2 years, 1 month ago.

Assisted by: Christopher Amirian.

Author
Posts
#2498875
Capture d’écran 2022-11-18 à 10.59.35.png
Capture d’écran 2022-11-18 à 10.59.18.png
Capture d’écran 2022-11-18 à 10.59.10.png

Hi !

I try to create a "load more" button with Toolset blocks, i search many times on forums and documentation but i can't find

Thanks a lot for you're help

#2500211

Christopher Amirian
Supporter

Languages: English (English )

Screen Shot 2022-11-20 at 17.51.55.png

Hi there,

In the Views block sidebar options, there is a section to add pagination. For more information:

https://toolset.com/course-lesson/creating-a-view/#add-pagination-to-a-view

There, you will be able to use the Ajax load functionality that works as the load more functionality,

To add a load more button itself you can use the method below:

https://toolset.com/forums/topic/load-more-button-3/#post-853208

Thanks.

#2500935

Thanks a lot for you're answer, that's work fine but i don't want load "page 2", i want lore more post keeping previous items

#2501241

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you. For that, the top answer which is the enabling of Infinite scroll should be still there and after that, you can enable only the NEXT link in the pagination settings and that will work as a load more button and the previous content will still show on the page and new content will be added.

Then you can change the look and feel of the NEXT link to be like the Load More Button with CSS.

Please check this answer here:

https://toolset.com/forums/topic/add-an-ajax-load-more-button-in-a-post-grid-view/#post-2008339

Thanks.

#2501259
Capture d’écran 2022-11-22 à 10.04.33.png
Capture d’écran 2022-11-22 à 10.04.25.png
Capture d’écran 2022-11-22 à 10.04.12.png

Thanks for you're answer Christopher but that don't work for me, the next button is here but the page reload content
i Use legacy mode is for that who don't work ?

#2501477

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

The setup you sent via screenshots seems to be ok. mmmm....

Maybe if I have access to the website I can check.

I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.

Make sure you set the next reply as private.

Also please tell me which view I should check that has the feature. And where you used that view in the pages.

Thank you.

#2502119

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you. I checked the pagination section and the item should be set as an Infinite scroll.

Then inside the Loop editor JS editor section I added the JS code below:

(function ($) {
    $(document).ready(function () {
   
        $('.js-wpv-layout-infinite-scrolling').removeClass('js-wpv-layout-infinite-scrolling');
   
    });
})(jQuery);

That did the trick and now it shows all the content and after clicking the Next button it adds up instead of replacing.

Thank you.

#2502167

That work very fine thanks so much !