更改WordPress中的分页链接
问题描述:
我得到分页链接 - >/page/3。但我想将这个“页面”更改为“新闻”。可能吗? 谢谢!更改WordPress中的分页链接
echo paginate_links(array(
'base' => str_replace($big2, '%#%', esc_url(get_pagenum_link($big2))),
'format' => '?paged1=%#%',
'current' => max(1, get_query_var('paged1')),
'total' => $news->max_num_pages,
'mid_size' => 0,
'type' => 'plain',
'end_size'=>0,
'prev_text' => '<IEPREKŠĒJĀ LAPA',
'next_text' => 'NĀKOŠĀ LAPA>'
));
答
您可以使用下面的代码
<?php
add_action('init', 'my_custom_page_word');
function my_custom_page_word() {
global $wp_rewrite; // Get the global wordpress rewrite-rules/settings
// Change the base pagination property which sets the wordpress pagination slug.
$wp_rewrite->pagination_base = "news"; //where new-slug is the slug you want to use ;)
}
?>
仅供参考更改分页基地,你可以参考以下链接
https://wordpress.stackexchange.com/questions/57070/change-the-page-slug-in-pagination
非常感谢你much.I有这样怪异的设计,也有在同一页上的两个分页。我想先留下“页面”,然后再换成“新闻”。 – Key