| Server IP : 172.67.147.195 / Your IP : 216.73.216.142 Web Server : Apache/2 System : Linux hosting8537.lvs 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : mienphi ( 1014) PHP Version : 8.2.14 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/mienphi/public_html/wp-content/plugins/learnpress-buddypress/inc/ |
Upload File : |
<?php
/**
* LearnPress BuddyPress Functions
*
* Define common functions for both front-end and back-end
*
* @author ThimPress
* @package LearnPress/BuddyPress/Functions
* @version 3.0.0
*/
// Prevent loading this file directly
defined( 'ABSPATH' ) || exit;
if ( ! function_exists( 'learn_press_buddypress_paging_nav' ) ) :
/**
* Display navigation to next/previous set of posts when applicable.
*
* @param array
*/
function learn_press_buddypress_paging_nav( $args = array() ) {
$args = wp_parse_args(
$args,
array(
'num_pages' => 0,
'paged' => get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1,
'wrapper_class' => 'learn-press-pagination',
'base' => false
)
);
if ( $args['num_pages'] < 2 ) {
return;
}
$paged = $args['paged'];
$pagenum_link = html_entity_decode( $args['base'] === false ? get_pagenum_link() : $args['base'] );
$query_args = array();
$url_parts = explode( '?', $pagenum_link );
if ( isset( $url_parts[1] ) ) {
wp_parse_str( $url_parts[1], $query_args );
}
$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
$format .= '?paged=%#%';
// Set up paginated links.
$links = paginate_links( array(
'base' => $pagenum_link,
'format' => $format,
'total' => $args['num_pages'],
'current' => max( 1, $paged ),
'mid_size' => 1,
'add_args' => array_map( 'urlencode', $query_args ),
'prev_text' => __( '<', 'learnpress-buddypress' ),
'next_text' => __( '>', 'learnpress-buddypress' ),
'type' => 'list'
) );
if ( $links ) { ?>
<div class="<?php echo $args['wrapper_class']; ?>"><?php echo $links; ?></div>
<!-- .pagination -->
<?php
}
}
endif;
add_action( 'template_redirect', 'bplp_template_redirect', - 10 );
function bplp_template_redirect() {
global $wp;
$bp = buddypress();
$endpoint = $bp->current_component;
if ( function_exists( 'is_wc_endpoint_url' ) && $endpoint != '' ) {
$wc_endpoints = WC()->query->get_query_vars();
foreach ( $wc_endpoints as $key => $value ) {
if ( $value === $endpoint ) {
unset( $wp->query_vars[ $key ] );
}
}
}
}