fixed category pagination.
This commit is contained in:
parent
993312fc3a
commit
e33e226983
@ -204,6 +204,23 @@ function cbsonline_category_year_link($url, $year)
|
|||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
add_filter('request', 'cbsonline_fix_category_pagination');
|
||||||
|
function cbsonline_fix_category_pagination($query = [])
|
||||||
|
{
|
||||||
|
if (isset($query['category_name']) && isset($query['page'])) {
|
||||||
|
if (preg_match('/^(?:category\/)?(.+)\/page$/', $query['category_name'], $matches)) {
|
||||||
|
$query['category_name'] = $matches[1];
|
||||||
|
}
|
||||||
|
$query['category_name'] .= $query['page'];
|
||||||
|
unset($query['page']);
|
||||||
|
if (isset($query['p'])) {
|
||||||
|
$query['paged'] = $query['p'];
|
||||||
|
unset($query['p']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
// support tag cloud for static pages
|
// support tag cloud for static pages
|
||||||
add_action('init', 'cbsonline_add_tag_to_page');
|
add_action('init', 'cbsonline_add_tag_to_page');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user