• i used a script which replaced Next and Prev with pagination:

    /*
    * Add pagination with 1,2,3 numbers to the “Posts In Page” plugin.
    */
    class ICPagePosts_Paginate_With_Numbers {

    public function __construct( ) {
    add_filter(‘posts_in_page_results’, array( &$this, ‘get_wp_query’ ));
    add_filter(‘posts_in_page_paginate’, array( &$this, ‘paginate_links’ ));
    }

    public function get_wp_query($posts){
    $this->posts = $posts;
    return $posts;
    }

    public function paginate_links($html){
    global $wp_query;
    $posts = $this->posts;
    $page_url = home_url( ‘/’ . $wp_query->post->post_name . ‘/’ );
    $page = isset( $_GET[‘page’] ) ? $_GET[‘page’] : 1;
    $total_pages = $posts->max_num_pages;
    $per_page = $posts->query_vars[‘posts_per_page’];
    $curr_page = ( isset( $posts->query_vars[‘paged’] ) && $posts->query_vars[‘paged’] > 0 ) ? $posts->query_vars[‘paged’] : 1;
    $prev = ( $curr_page && $curr_page > 1 ) ? ‘<li class=”pag1″>Previous‘ : ”;
    $next = ( $curr_page && $curr_page < $total_pages ) ? ‘<li class=”pag1″>Next‘ : ”;
    $numbers = ”;
    for ($i = 1; $i < $total_pages+1; $i++){
    if ($i == $curr_page) {
    $numbers .= ‘<li class=”pag1″>’ . $i . ‘‘;
    } else {
    $numbers .= ‘<li class=”pag1″>‘ . $i . ‘‘;
    }
    }
    return ‘<ul class=”pag1″>’ . $prev . $numbers . $next . ‘‘;
    }
    }
    new ICPagePosts_Paginate_With_Numbers();

    This script stopped working at 1.3 i think. I can see why though. It makes a link in the old way you used to call the second page:
    https://croatiagems.staging.wpengine.com/dubrovnik-villas/?page=2

    I can see now it uses parent pages (Or maybe the client changed structure) but equally importantly it does not use the “?page=” syntax at the end anymore:
    https://www.croatiagems.com/villas-apartments/villas-in-croatia/dubrovnik-villas/page/2/

    Can you tell me how to change the above script to make pagination work with the latest 1.4.4 version? I have tried quite a few things and i can’t get it to work.

    many thanks

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘pagination not working’ is closed to new replies.