|
Server IP : 10.106.20.8 / Your IP : 216.73.216.148 Web Server : Apache System : Linux webm008.cluster106.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : sixiemesrc ( 611999) PHP Version : 8.0.30 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/sixiemesrc/new/wp-content/themes/gaaga/../gaaga/ocdi/../modules/pagination/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
add_action( 'gaaga_after_main_css', 'pagination_style' );
function pagination_style() {
wp_enqueue_style( 'gaaga-pagination', get_theme_file_uri('/modules/pagination/assets/css/pagination.css'), false, GAAGA_THEME_VERSION, 'all');
}
if( !function_exists( 'after_single_page_content_wp_link_pages' ) ) {
function after_single_page_content_wp_link_pages() {
wp_link_pages(array(
'before' => '<div class="page-link">',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
'next_or_number' => 'number',
'pagelink' => '%',
));
edit_post_link( esc_html__( ' Edit ','gaaga' ) );
}
add_action( 'gaaga_after_single_page_content', 'after_single_page_content_wp_link_pages' );
}
if( !function_exists( 'gaaga_pagination' ) ) {
function gaaga_pagination( $query = false, $load_more = false ) {
global $wp_query;
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : ( ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1 );
// default $wp_query
if( $query ) {
$custom_query = $query;
} else {
$custom_query = $wp_query;
}
$custom_query->query_vars['paged'] > 1 ? $current = $custom_query->query_vars['paged'] : $current = 1;
if( empty( $paged ) ) $paged = 1;
$prev = $paged - 1;
$next = $paged + 1;
$end_size = 1;
$mid_size = 2;
#$show_all = gaaga_get_option( 'showall-pagination' );
$dots = false;
if( ! $total = $custom_query->max_num_pages ) $total = 1;
$output = '';
if( $total > 1 )
{
if( $load_more ){
// ajax load more -------------------------------------------------
if( $paged < $total ){
$output .= '<div class="column one pager_wrapper pager_lm">';
$output .= '<a class="pager_load_more button button_js" href="'. get_pagenum_link( $next ) .'">';
$output .= '<span class="button_icon"><i class="icon-layout"></i></span>';
$output .= '<span class="button_label">'. esc_html__('Load more', 'gaaga') .'</span>';
$output .= '</a>';
$output .= '</div>';
}
} else {
add_filter( 'number_format_i18n', 'gaaga_zero_prefix_pagination' );
// default --------------------------------------------------------
$output .= '<div class="column one pager_wrapper">';
$big = 999999999; // need an unlikely integer
$args = array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'total' => $custom_query->max_num_pages,
'current' => max( 1, get_query_var('paged') ),
#'show_all' => $show_all,
'end_size' => $end_size,
'mid_size' => $mid_size,
'prev_next' => true,
'prev_text' => '<span><i class="fa fa-circle" aria-hidden="true"></i></span>'.esc_html__('Previous', 'gaaga'),
'next_text' => esc_html__('Next', 'gaaga').'<span><i class="fa fa-circle" aria-hidden="true"></i></span>',
'type' => 'list'
);
$output .= paginate_links( $args );
$output .= '</div>'."\n";
}
}
return $output;
}
}
if( ! function_exists( 'gaaga_zero_prefix_pagination' ) ) :
function gaaga_zero_prefix_pagination( $format ) {
$number = intval( $format );
if( intval( $number / 10 ) > 0 ) {
return $format;
}
return '0' . $format;
}
endif;