Wordpress URL rewriting

Associate
Joined
23 Jun 2004
Posts
1,098
Location
London
Hi,

I have a wordpress site using wp-pagenavi and it formats the URLS as:

www.example.com/postname/1/
www.example.com/postname/2/
www.example.com/postname/3/

Is it possible to change this via custom rewriting rules to

www.example.com/postname/page-1/

or

www.example.com/postname-1 (which isn't pagination but a new page for each part I guess)

or something similar to that instead of just the /x/ have /text-x/ at the end?

I am not really sure what to look into. I tried looking around but got stuck quite quickly.

Any help would really be appreciated.

Thank you
 
Associate
OP
Joined
23 Jun 2004
Posts
1,098
Location
London
Yeah unfortunately none of them seem to work the way I want. I think this needs some editing to the pagination structure within wordpress/the addin. I don't mind paying for it either but not sure what to ask for or where.
 
Soldato
Joined
8 May 2011
Posts
4,939
Location
HQ
You should be able to create a custom short code. Look in functions.php for wp-pagenavi and update with something like the following:


Code:
// Get the page number into wp_pagenavi
function pagenavi_paged($query) {
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$query->query_vars['paged'] = $paged;
return $query;
}
// Add a custom pagination short code
function custom_pagination($args, $content) {
global $WP_Views;
wp_pagenavi( array('query' => $WP_Views->post_query) );
}
add_shortcode('custom-pagination', 'custom-pagination');
 
Last edited:
Associate
Joined
10 Sep 2015
Posts
27
Location
Germany
Are you looking for this?
2460rjr.jpg


oops sorry, is not this. Cant delete post.
 
Last edited:
Back
Top Bottom