WordPress.org

Forums

WP-PageNavi
[resolved] Pagination Issues (10 posts)

  1. evoke07
    Member
    Posted 11 months ago #

    the numbers are not appearing in the pagination - they were but my client probably updated wp and the plugin and now they are not working together

    h newer postspreviouspostslinkhPAGE_NUMBER%page smaller2hPAGE_NUMBER%page largerhPAGE_NUMBER%page largerhPAGE_NUMBER%page larger...hPAGE_NUMBER%larger pagehPAGE_NUMBER%larger page...hast ┬╗last
    PUBLICATIONS: Afar Birchbox Bloomberg Businessweek Bon Appetit Budget Travel Conde Nast Traveler
    - See more at: http://geraldinecampbell.com/portfolios/page/2/#sthash.2aogMyVr.dpuf

    url can be found here

    http://tinyurl.com/kxduy2g

    any help to get it back to 1,2,3,4 etc would be great

    https://wordpress.org/plugins/wp-pagenavi/

  2. Lester Chan
    Member
    Plugin Author

    Posted 11 months ago #

    Go to WP-Admin -> Settings -> PageNavi and change the PAGE_NUMBER% to %PAGE_NUMBER% in the templates section

  3. evoke07
    Member
    Posted 11 months ago #

    Thanks lester,

    but it was already set to %PAGE_NUMBER%?

    any other advice?

  4. Lester Chan
    Member
    Plugin Author

    Posted 11 months ago #

    Could you print screen your pagenavi options?

    Also how are you including the pagenavi? I can't any reference to <div class='wp-pagenavi'> in your HTML output code at all.

    I am guessing someone modified the plugin itself and hence it broke.

  5. evoke07
    Member
    Posted 11 months ago #

    Hey,

    I deleted the updated plugin and uploaded the original plugin files from the custom theme.

    here are my pagenavi options

    http://geraldinecampbell.com/wp-content/uploads/2014/06/screenshot.jpg

    on my template-portfolio.php ref to pagenavi is

    <?php if(function_exists('cm_pagenavi')): ?>
    <ul class="paging">
    <?php cm_pagenavi() ?>

    <?php endif ?>

    is this helpful for solution?

  6. Lester Chan
    Member
    Plugin Author

    Posted 11 months ago #

    Err you might need to contact your theme author or the guy who wrote cm_pagenavi() as it is a modified version of the plugin

  7. evoke07
    Member
    Posted 11 months ago #

    here is the function

    /* --- wp_pagenavi --- */
    function cm_pagenavi( $args = array() ) {
    	if ( !is_array( $args ) ) {
    		$argv = func_get_args();
    		$args = array();
    		foreach ( array( 'before', 'after', 'options' ) as $i => $key )
    			$args[ $key ] = $argv[ $i ];
    	}
    
    	$args = wp_parse_args( $args, array(
    		'before' => '',
    		'after' => '',
    		'options' => array(),
    		'query' => $GLOBALS['wp_query'],
    		'type' => 'posts',
    		'echo' => true
    	) );
    
    	extract( $args, EXTR_SKIP );
    
    	$options = wp_parse_args( $options, PageNavi_Core::$options->get() );
    
    	$instance = new PageNavi_Call( $args );
    
    	list( $posts_per_page, $paged, $total_pages ) = $instance->get_pagination_args();
    
    	if ( 1 == $total_pages && !$options['always_show'] )
    		return;
    
    	$pages_to_show = absint( $options['num_pages'] );
    	$larger_page_to_show = absint( $options['num_larger_page_numbers'] );
    	$larger_page_multiple = absint( $options['larger_page_numbers_multiple'] );
    	$pages_to_show_minus_1 = $pages_to_show - 1;
    	$half_page_start = floor( $pages_to_show_minus_1/2 );
    	$half_page_end = ceil( $pages_to_show_minus_1/2 );
    	$start_page = $paged - $half_page_start;
    
    	if ( $start_page <= 0 )
    		$start_page = 1;
    
    	$end_page = $paged + $half_page_end;
    
    	if ( ( $end_page - $start_page ) != $pages_to_show_minus_1 )
    		$end_page = $start_page + $pages_to_show_minus_1;
    
    	if ( $end_page > $total_pages ) {
    		$start_page = $total_pages - $pages_to_show_minus_1;
    		$end_page = $total_pages;
    	}
    
    	if ( $start_page < 1 )
    		$start_page = 1;
    
    	$out = '';
    	switch ( intval( $options['style'] ) ) {
    		// Normal
    		case 1:
    			// Text
    			if ( !empty( $options['pages_text'] ) ) {
    				$pages_text = str_replace(
    					array( "%CURRENT_PAGE%", "%TOTAL_PAGES%" ),
    					array( number_format_i18n( $paged ), number_format_i18n( $total_pages ) ),
    				$options['pages_text'] );
    				$out .= "
    <li>$pages_text</li>
    ";
    			}
    
    			if ( $start_page >= 2 && $pages_to_show < $total_pages ) {
    				// First
    				$first_text = str_replace( '%TOTAL_PAGES%', number_format_i18n( $total_pages ), $options['first_text'] );
    				$out .= $instance->get_single( 1, 'first', $first_text, '%TOTAL_PAGES%' );
    			}
    
    			// Previous
    			if ( $paged > 1 && !empty( $options['prev_text'] ) )
    				$out .= '<li class="prev">' . $instance->get_single( $paged - 1, 'previouspostslink', $options['prev_text'] ) . '';
    
    			if ( $start_page >= 2 && $pages_to_show < $total_pages ) {
    				if ( !empty( $options['dotleft_text'] ) )
    					$out .= "
    <li>{$options['dotleft_text']}</li>
    ";
    			}
    
    			// Smaller pages
    			$larger_pages_array = array();
    			if ( $larger_page_multiple )
    				for ( $i = $larger_page_multiple; $i <= $total_pages; $i+= $larger_page_multiple )
    					$larger_pages_array[] = $i;
    
    			$larger_page_start = 0;
    			foreach ( $larger_pages_array as $larger_page ) {
    				if ( $larger_page < ($start_page - $half_page_start) && $larger_page_start < $larger_page_to_show ) {
    					$out .= $instance->get_single( $larger_page, 'smaller page', $options['page_text'] );
    					$larger_page_start++;
    				}
    			}
    
    			if ( $larger_page_start )
    				$out .= "
    <li>{$options['dotleft_text']}</li>
    ";
    
    			// Page numbers
    			$timeline = 'smaller';
    			foreach ( range( $start_page, $end_page ) as $i ) {
    				if ( $i == $paged && !empty( $options['current_text'] ) ) {
    					$current_page_text = str_replace( '%PAGE_NUMBER%', number_format_i18n( $i ), $options['current_text'] );
    					$out .= "
    <li><strong>$current_page_text</strong></li>
    ";
    					$timeline = 'larger';
    				} else {
    					$out .= '
    <li>' . $instance->get_single( $i, "page $timeline", $options['page_text'] ) . '</li>
    ';
    				}
    			}
    
    			// Large pages
    			$larger_page_end = 0;
    			$larger_page_out = '';
    			foreach ( $larger_pages_array as $larger_page ) {
    				if ( $larger_page > ($end_page + $half_page_end) && $larger_page_end < $larger_page_to_show ) {
    					$larger_page_out .= '
    <li>' . $instance->get_single( $larger_page, 'larger page', $options['page_text'] ) . '</li>
    ';
    					$larger_page_end++;
    				}
    			}
    
    			if ( $larger_page_out ) {
    				$out .= "
    <li>{$options['dotright_text']}</li>
    ";
    			}
    			$out .= $larger_page_out;
    
    			if ( $end_page < $total_pages ) {
    				if ( !empty( $options['dotright_text'] ) )
    					$out .= "
    <li>{$options['dotright_text']}</li>
    ";
    			}
    
    			// Next
    			if ( $paged < $total_pages && !empty( $options['next_text'] ) )
    				$out .= '<li class="next">' . $instance->get_single( $paged + 1, '', $options['next_text'] ) . '';
    
    			if ( $end_page < $total_pages ) {
    				// Last
    				$out .= $instance->get_single( $total_pages, 'last', $options['last_text'], '%TOTAL_PAGES%' );
    			}
    			break;
    
    		// Dropdown
    		case 2:
    			$out .= '<form action="" method="get">'."\n";
    			$out .= '<select size="1" onchange="document.location.href = this.options[this.selectedIndex].value;">'."\n";
    
    			foreach ( range( 1, $total_pages ) as $i ) {
    				$page_num = $i;
    				if ( $page_num == 1 )
    					$page_num = 0;
    
    				if ( $i == $paged ) {
    					$current_page_text = str_replace( '%PAGE_NUMBER%', number_format_i18n( $i ), $options['current_text'] );
    					$out .= '<option value="'.esc_url( $instance->get_url( $page_num ) ).'" selected="selected" class="current">'.$current_page_text."</option>\n";
    				} else {
    					$page_text = str_replace( '%PAGE_NUMBER%', number_format_i18n( $i ), $options['page_text'] );
    					$out .= '<option value="'.esc_url( $instance->get_url( $page_num ) ).'">'.$page_text."</option>\n";
    				}
    			}
    
    			$out .= "</select>\n";
    			$out .= "</form>\n";
    			break;
    	}
    	$out = $before . $out . $after;
    
    	$out = apply_filters( 'wp_pagenavi', $out );
    
    	if ( !$echo )
    		return $out;
    
    	echo $out;
    }
    ?>

    [Moderator Note: Please post code or markup between backticks or use the code button. Or better still - use a pastebin. Your posted code may now have been permanently damaged by the forum's parser.]

  8. Lester Chan
    Member
    Plugin Author

    Posted 11 months ago #

    Sorry I don't provide support for modifications of my plugin since I am not the one who wrote it.

    I think it is better you use wp_pagenavi() or you have to contact the person who wrote the modification to update it to work with the latest version of wp_pagenavi.

  9. evoke07
    Member
    Posted 11 months ago #

    hey thanks,

    i just removed the cm reference and brought in the un-moded version and made a few edits and seems to be working now

    thanks for your help though.

  10. Lester Chan
    Member
    Plugin Author

    Posted 11 months ago #

    Cool glad it works for you =)

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.