Created
October 11, 2023 12:15
-
-
Save champsupertramp/a358f46559a1db872b2159d91d406684 to your computer and use it in GitHub Desktop.
Ultimate Member - Increase Pagination Range in Member Directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'um_ajax_get_members_response', function( $data ) { | |
$pagination_range = 6; | |
$max_value = max( $data['pagination']['pages_to_show'] ) + $pagination_range; | |
$min_value = min( $data['pagination']['pages_to_show'] ) - $pagination_range; | |
if( $max_value >= $data['pagination']['total_pages'] ) { | |
$max_value = $data['pagination']['total_pages']; | |
} | |
if( $min_value < 1 ) { | |
$min_value = 1; | |
} | |
$data['pagination']['pages_to_show'] = range( $min_value, $max_value ) ; | |
return $data; | |
}, 10 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment