WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
add_rewrite_rule disabled Pagenavi... (3 posts)

  1. s4m
    Member
    Posted 9 months ago #

    Hi, Pagenavi users.
    Without add_rewrite_rule this URL works e.g. http://www.mysite.com/acer/aspire_e/

    <?php
    function add_query_vars($new_var) {
    $new_var[] = "ps";
    $new_var[] = "page";
    return $new_var;
    }
    add_filter('query_vars', 'add_query_vars');
    
    function add_rewrite_rules($myrules) {
    $newrules = array(
    '^acer/(aspire_e|aspire_p|aspire_m)/?$' => 'index.php?page_id=997&ps=$matches[1]', 'top',    '^acer/(aspire_e|aspire_p|aspire_m)(/page/?([0-9]{1,}))/?$' => 'index.php?page_id=997&ps=$matches[1]&page=$matches[2]', 'top'
    );
    $myrules = $newrules + $myrules;
    return $myrules;
    }
    add_filter('rewrite_rules_array', 'add_rewrite_rules');
    ?>

    but when I apply add_rewrite_rule pagination doesn't work anymore. Though the add_rewrite_rule gives the URL
    http://www.mysite.com/acer/aspire_e/page/2/ for example.
    Have anyone here encountered this error? any help would be appreciated. :)

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

  2. s4m
    Member
    Posted 9 months ago #

    this $new_var[] = "page"; supposed to be paged! SOLVED...

  3. s4m
    Member
    Posted 9 months ago #

    this $new_var[] = "page"; supposed to be $new_var[] = "paged"; SOLVED...

Reply

You must log in to post.

About this Plugin

About this Topic