Skip Navigation

[Resolved] Is there a way to add a View All function to pagination

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 16 replies, has 3 voices.

Last updated by Shane 6 years, 11 months ago.

Assisted by: Shane.

Author
Posts
#518416

Hey Christian,

I have a question about pagination. Is there a way to add a View All function (button) to pagination? If you look at any of the People Types, you'll see pagination, but I'd like to also have a button that users can click to View All the results.

Thx,
moi06

#518450

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Thank you for contacting our support forum.

Actually this is not possible as we currently don't have a function that will allow you to view all the results on the same view.

What you can do as a workaround is to create an identical view without the pagination that lists all the records. Then create a view all link from your first view that links to the next view on another page.

Please let me know if this helps.
Thanks,
Shane

#518781

hmm, well is there a way to display more than 50 results, say 100 results?

moi06

#518898

Second this 🙂

#519073

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Guys,

Actually no the current limit is 50 per page.

Thanks,
Shane

#519870

So you mean to tell me there's no way to increase that limit at all. Is there a work around?

#519886

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

I did some checks on our API document and it is possible with the use of a hook.

Add the following to your functions.php file

//Modify the limit and/or offset settings of a given View to use a number greater than 50:
add_filter( 'wpv_view_settings', 'prefix_modify_filter_offset_view', 5, 2 ); // use a low priority number of 5, so this runs early
function prefix_modify_filter_offset_view( $view_settings, $view_id ) {
    if ( $view_id == 374 ) { // if displaying a View with ID equal to 374
        $view_settings['limit'] = 100; // show 100 posts
    }
    return $view_settings;
}

Change the 374 to the id of your view that you are using. For more information on this hook and other hooks you can have a look at our API document in the link below.

https://toolset.com/documentation/programmer-reference/views-filters/#wpv_view_settings

Thanks,
Shane

#519897

Is that for the functions.php file in my themes folder?

moi06

#519898

Also, should the limit on views be set to No Limit as well?

moi06

#519954

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Yes this is for the functions.php file for your theme and this function will override the limit set in your view.

Thanks,
Shane

#520353

Ok, so now here's the other issue. That code works, thank you. However, when I add pagination to my search, it doesn't work. It displays the results based on the pagination, not the code. Let me explain what I want my final goal to be. I want to create a search with pagination, but I want to display 100 results. If a search brings back more than 100 results, I want the pagination to appear. But I only want pagination to appear only if the results are more than 100. So, a search that can display 100 result and for pagination to only appear if a search returns more than 100 results.

moi06

#520366

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Does your search use AJAX for the pagination ?

Thanks,
Shane

#520372
Untitled-1.jpg

Yes, see attached image.

#520375

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Could you try this as a test for me ?

I would like to see if this works when a regular non-ajax pagination is used.

If this works then I would need to escalate this for a solution with AJAX to be found.

Thanks,
Shane

#520386

Hey Shane,

Still not working.

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.