WordPress 101 主题开发教程: 05 – 创建指定页面模板

WordPress 101 – Part 5: How to create Custom and Specialized Page Templates

视频学习参考: https://www.youtube.com/watch?v=aUxDz7vXilQ&list=PLriKzYyLb28nUFbe0Y9d-19uVkOnhYxFE&index=5

1.创建page-about-me.php会自动映射给关于页面

注:发现/about-me/这个别名没设置 设置了之后又是404 于是一番查询

发现是nginx配置信息的问题 参考下面的链接配置

https://wordpress.org/support/article/nginx/

其实重点就是缺少这个

location / {

# This is cool because no php is touched for static content.

# include the "?$args" part so non-default permalinks doesn't break when using query string

try_files $uri $uri/ /index.php?$args;

}

配置完重启下nginx 就可以了

映射生效 终于可以用英文名访问了,其实别名取为中文也可以访问到

2.通过页面中设置模板选择指定模板页面

页面编辑中 右侧选择指定模板

Super Easy!