: This article mainly introduces the page-based static wordpress list and adds html suffixes. For more information about PHP tutorials, see. First View Results
After use, the URL is http: // localhost/news/paged/1.html.
1. HTML suffix
Add_filter ('Get _ pagenum_link ', 'My _ get_pagenum_link', 1, 1 );
Function my_get_pagenum_link ($ url)
{
Return str_replace('.html ', '', URL extension .'.html ';
}
2. add rewrite rules
If (! Is_admin () // only front-end page Applications
{
Add_action ('init ', 'My _ post_rewrite ');
}
Function my_post_rewrite ()
{
Global $ wp_rewrite;
Add_rewrite_rule ('news/paged /(.*)?. Html $ ', 'index. php? P = news & page = $ matches [2] ', 'top'); // only enables the slug to be 'new'.
Add_rewrite_rule ('(.*)? /Paged /(.*)?. Html $ ', 'index. php? P = $ matches [1] & page = $ matches [2] ', 'top'); // applies to all types
}
Note: the regular expression may change according to your actual situation.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above introduces static pages of The wordpress article list, adding html suffixes, including content, and hope to be helpful to friends who are interested in PHP tutorials.