How to change pagination for posts with WP-PageNavi plugin

I have installed WP-PageNavi plugin but it’s not working for the blog post page.

Hello Joy,

Regretfully this isn’t a feature offered by X. The plugin is not supported in the X theme either. It could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

For a start you may refer to the link below.

https://codex.wordpress.org/Next_and_Previous_Links

Thanks for understanding. Take care!

Hello RueNel

I think WP-PageNavi plugin works with the theme. Please check the below link. It’s a custom post type template.

So we need pagination the same as the above link for these two pages. Is this possible?


Thank you

Hi Joy,

WP-PageNavi is a third party plugin and is not natively supported by X. Any question about its implementation to the theme goes beyond the scope of our support.

It would be best to get in touch with the plugin support on how to have that plugin override a theme’s overall pagination. This due to the fact that there is simply no way to account for all of the potential variables at play when using another developer’s plugin or script.

Thank you.

Ok, is it possible to modify Pro theme pagination for blog posts ?

Is it possible to display blog posts on a normal page and display the same blog post page?

I want to display the below list of posts on another page.

Hey Joy,

For that, you will need to use either one of the bundled grid plugins as they allow the displaying a list of posts. Please see the items below:

Hope that helps.

Hello,

I just want to change pagination style. Is it possible to change pagination in this theme?

Like below example.

First page
1 2 3 4 5 … 10 >> Last >>

Any middle page
<< First << … 6 7 8 9 10 … >> Last >>

Last page
<< First << 1 … 6 7 8 9 10

Thank you

Hey Joy,

Regretfully this isn’t a feature offered by X. It could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.

Thanks for understanding. Take care!

Hello christian_y,

Could you tell me which has the pagination code in the Pro theme? So I can get it to the child theme and customize it.

Thank you

Hi Joy,

This is the entire code:

// Pagination
// =============================================================================

if ( ! function_exists( 'pagenavi' ) ) :
  function pagenavi($before = '', $after = '') {

    global $wpdb, $wp_query;
    $pagenavi_options = array();
    $pagenavi_options['pages_text']                   = ('Page %CURRENT_PAGE% of %TOTAL_PAGES%');
    $pagenavi_options['current_text']                 = '%PAGE_NUMBER%';
    $pagenavi_options['page_text']                    = '%PAGE_NUMBER%';
    $pagenavi_options['first_text']                   = __( 'First Page', '__x__' );
    $pagenavi_options['last_text']                    = __( 'Last Page', '__x__' );
    $pagenavi_options['next_text']                    = '&#x2192;';
    $pagenavi_options['prev_text']                    = '&#x2190;';
    $pagenavi_options['dotright_text']                = '...';
    $pagenavi_options['dotleft_text']                 = '...';
    $pagenavi_options['num_pages']                    = 3;
    $pagenavi_options['always_show']                  = 0;
    $pagenavi_options['num_larger_page_numbers']      = 0;
    $pagenavi_options['larger_page_numbers_multiple'] = 3;

    if ( ! is_single() ) {
      $request        = $wp_query->request;
      $posts_per_page = intval( get_query_var( 'posts_per_page' ) );
      $paged          = intval( get_query_var( 'paged' ) );
      $numposts       = $wp_query->found_posts;
      $max_page       = $wp_query->max_num_pages;

      if( empty($paged) || $paged == 0 ) {
        $paged = 1;
      }

      $pages_to_show         = intval( $pagenavi_options['num_pages'] );
      $larger_page_to_show   = intval( $pagenavi_options['num_larger_page_numbers'] );
      $larger_page_multiple  = intval( $pagenavi_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 > $max_page ) {
        $start_page = $max_page - $pages_to_show_minus_1;
        $end_page   = $max_page;
      }

      if ( $start_page <= 0 ) {
        $start_page = 1;
      }

      $larger_per_page         = $larger_page_to_show * $larger_page_multiple;
      $larger_start_page_start = ( x_round_nearest( $start_page, 10 ) + $larger_page_multiple ) - $larger_per_page;
      $larger_start_page_end   = x_round_nearest( $start_page, 10 ) + $larger_page_multiple;
      $larger_end_page_start   = x_round_nearest( $end_page, 10 ) + $larger_page_multiple;
      $larger_end_page_end     = x_round_nearest( $end_page, 10 ) + $larger_per_page;

      if ( $larger_start_page_end - $larger_page_multiple == $start_page ) {
        $larger_start_page_start = $larger_start_page_start - $larger_page_multiple;
        $larger_start_page_end   = $larger_start_page_end - $larger_page_multiple;
      }

      if ( $larger_start_page_start <= 0 ) {
        $larger_start_page_start = $larger_page_multiple;
      }

      if ( $larger_start_page_end > $max_page ) {
        $larger_start_page_end = $max_page;
      }

      if ( $larger_end_page_end > $max_page ) {
        $larger_end_page_end = $max_page;
      }

      if ( $max_page > 1 || intval( $pagenavi_options['always_show'] ) == 1 ) {
        $pages_text = str_replace( "%CURRENT_PAGE%", number_format_i18n( $paged ) , $pagenavi_options['pages_text'] );
        $pages_text = str_replace( "%TOTAL_PAGES%", number_format_i18n( $max_page ) , $pages_text );
        echo $before . '<div class="x-pagination"><ul class="center-list center-text">' . "\n";

        if ( ! empty( $pages_text ) ) {
          echo '<li><span class="pages">' . $pages_text . '</span></li>';
        }

        echo '<li>'; previous_posts_link( $pagenavi_options['prev_text'] ); echo '</li>';

        if ( $start_page >= 2 && $pages_to_show < $max_page ) {
          $first_page_text = str_replace( "%TOTAL_PAGES%", number_format_i18n( $max_page ), $pagenavi_options['first_text'] );
          echo '<li><a href="' . esc_url( get_pagenum_link() ) . '" class="first" title="' . $first_page_text . '">1</a></li>';
          if ( ! empty( $pagenavi_options['dotleft_text'] ) ) {
            echo '<li><span class="expand">' . $pagenavi_options['dotleft_text'] . '</span></li>';
          }
        }

        if ( $larger_page_to_show > 0 && $larger_start_page_start > 0 && $larger_start_page_end <= $max_page ) {
          for ( $i = $larger_start_page_start; $i < $larger_start_page_end; $i += $larger_page_multiple ) {
            $page_text = str_replace( "%PAGE_NUMBER%", number_format_i18n( $i ), $pagenavi_options['page_text'] );
            echo '<li><a href="' . esc_url( get_pagenum_link( $i ) ) . '" class="single_page" title="' . $page_text . '">' . $page_text . '</a></li>';
          }
        }

        for ( $i = $start_page; $i  <= $end_page; $i++ ) {
          if ( $i == $paged ) {
            $current_page_text = str_replace( "%PAGE_NUMBER%", number_format_i18n( $i ), $pagenavi_options['current_text'] );
            echo '<li><span class="current">' . $current_page_text . '</span></li>';
          } else {
            $page_text = str_replace( "%PAGE_NUMBER%", number_format_i18n( $i ), $pagenavi_options['page_text'] );
            echo '<li><a href="' . esc_url( get_pagenum_link( $i ) ) . '" class="single_page" title="' . $page_text . '">' . $page_text . '</a></li>';
          }
        }

        if ( $end_page < $max_page ) {
          if ( ! empty( $pagenavi_options['dotright_text'] ) ) {
            echo '<li><span class="expand">' . $pagenavi_options['dotright_text'] . '</span></li>';
          }
          $last_page_text = str_replace( "%TOTAL_PAGES%", number_format_i18n( $max_page ), $pagenavi_options['last_text'] );
          echo '<li><a href="' . esc_url( get_pagenum_link( $max_page ) ) . '" class="last" title="' . $last_page_text . '">' . $max_page . '</a></li>';
        }
        echo '<li>'; next_posts_link( $pagenavi_options['next_text'], $max_page ); echo '</li>';

        if ( $larger_page_to_show > 0 && $larger_end_page_start < $max_page ) {
          for ( $i = $larger_end_page_start; $i <= $larger_end_page_end; $i += $larger_page_multiple ) {
            $page_text = str_replace( "%PAGE_NUMBER%", number_format_i18n( $i ), $pagenavi_options['page_text'] );
            echo '<li><a href="' . esc_url( get_pagenum_link( $i ) ) . '" class="single_page" title="' . $page_text . '">' . $page_text . '</a></li>';
          }
        }
        echo '</ul></div>' . $after . "\n";
      }
    }

  }
endif;

You can find it in: wp-content/themes/pro/framework/functions/frontend/pagination.php.

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.