[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 7 years, 7 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.
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.
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.
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.
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.