文章的伪静态很好实现,不要任何代码,但是页面的不行,于是我们就要让页面也支持伪静态,也就是后面加上.html。

还是在function.php中加入代码:

//页面链接添加html后缀
function html_page_permalink() {
global $wp_rewrite;
if ( !strpos($wp_rewrite->get_page_permastruct(), '.html')){
$wp_rewrite->page_structure = $wp_rewrite->page_structure . '.html';
}
}
add_action('init', 'html_page_permalink', -1);

然后在后台的固定链接中重新保存一下,看一下xxx是不是变成xxx.html啦!

本文转载自八方博客

参与评论