query_vars['paged'] > 1 ? $current = $job_query->query_vars['paged'] : $current = 1; // Pagination Arguments $pagination_args = array( 'base' => @add_query_arg('page', '%#%'), 'format' => '?paged=%#%', 'total' => $job_query->max_num_pages, 'current' => $current, 'show_all' => FALSE, 'next_text' => '', 'prev_text' => '', 'type' => 'array', 'end_size' => 4, 'mid_size' => 4, ); // Paginaton Base for Different Types of Pages if ( is_front_page() && ( NULL != filter_input(INPUT_GET, 'selected_category') || NULL != filter_input(INPUT_GET, 'selected_jobtype') || NULL != filter_input(INPUT_GET, 'selected_location') || filter_input(INPUT_GET, 'search_keywords') ) ) { // Paginaton Base for Home Page & Static Front Page $big = 999999999; // Need an unlikely integer if ($wp_rewrite->using_permalinks()) { $url = explode('?', get_pagenum_link($big)); // Get URL without Query String $pagination_args['base'] = str_replace($big, '%#%', esc_url($url[0])); } } else { //Paginaton Base for WP Post/Page $pagination_args['base'] = @add_query_arg('page', '%#%'); } /** * Modify query string. * * Remove query "page" argument from permalink */ if (! ( NULL != filter_input(INPUT_GET, 'selected_category') || NULL != filter_input(INPUT_GET, 'selected_jobtype') || NULL != filter_input(INPUT_GET, 'selected_location') || filter_input(INPUT_GET, 'search_keywords') ) ) { if ($wp_rewrite->using_permalinks()) { $pagination_args['base'] = user_trailingslashit(trailingslashit(remove_query_arg('page', get_pagenum_link(1))) . '?page=%#%/', 'paged'); } if (!empty($job_query->query_vars['s'])) { $pagination_args['add_args'] = array('s' => get_query_var('s')); } } $pagination = apply_filters('sjb_pagination_links_default_args', $pagination_args); // Retrieve paginated link for job posts $pages = paginate_links( $pagination ); if ( is_array( $pages ) ) { $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged'); ?>