2017-03-15 117 views
0

我得到分頁鏈接 - >/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>' 
)); 

回答

0

您可以使用下面的代碼

<?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

+0

非常感謝你much.I有這樣怪異的設計,也有在同一頁上的兩個分頁。我想先留下「頁面」,然後再換成「新聞」。 – Key