• I’m having a problem with the pagination function for my page.

    I have this error: Warning: Missing argument 2 for add_action(), called in /data/web/virtuals/135410/virtual/www/wp-content/themes/baskerville-child/functions.php on line 19 and defined in /data/web/virtuals/135410/virtual/www/wp-includes/plugin.php on line 457

    Here’s the code that I am currently using in functions.php

    add_action( 'wpex_pagination' );
    
    if ( !function_exists( 'wpex_pagination' ) ) {
    
    	function wpex_pagination() {
    
    		$prev_arrow = is_rtl() ? '→' : '←';
    		$next_arrow = is_rtl() ? '←' : '→';
    
    		global $wp_query;
    		$total = $wp_query->max_num_pages;
    		$big = 999999999; // need an unlikely integer
    		if( $total > 1 )  {
    			 if( !$current_page = get_query_var('paged') )
    				 $current_page = 1;
    			 if( get_option('permalink_structure') ) {
    				 $format = 'page/%#%/';
    			 } else {
    				 $format = '&paged=%#%';
    			 }
    			echo paginate_links(array(
    				'base'			=> str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    				'format'		=> $format,
    				'current'		=> max( 1, get_query_var('paged') ),
    				'total' 		=> $total,
    				'mid_size'		=> 1,
    				'type' 			=> 'list',
    				'prev_text'		=> $prev_arrow,
    				'next_text'		=> $next_arrow,
    			 ) );
    		}
    	}
    
    }

    Any help would be greatly appreciated. Thanks.

  • The topic ‘Pagination Error’ is closed to new replies.