新增主题

  1. 随便复制一个主题到test文件夹
  2. test主题文件cnpm I
    npm i 失败的可以使用淘宝镜像 cpm i
  3. 热更新

主题介绍

test目录下的style.css

  1. /*
  2. Theme Name: 主题名
  3. Text Domain: 由来(哪个团队)
  4. Version: 1.0
  5. Requires at least: 4.7
  6. Requires PHP: 5.2.4
  7. Description: 简介
  8. Author: 作者
  9. Author URI: https://wordpress.org/
  10. Theme URI: https://wordpress.org/themes/twentytwenty/
  11. License: GNU General Public License v2 or later
  12. License URI: http://www.gnu.org/licenses/gpl-2.0.html
  13. All files, unless otherwise stated, are released under the GNU General Public
  14. License version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html)
  15. This theme, like WordPress, is licensed under the GPL.
  16. Use it to make something cool, have fun, and share what you've learned
  17. with others.
  18. */

替换主题封面

主题封面是红色框内的图片,只要替换主题目录下的图片screenshot.png(1200*900)

WordPress线上部署及更新主题 - 图1

部署到线上

WordPress站需要转https,各种配置都配了,前台、登录页也显示正常,但就是登录不了后台页面!!

问题1: “抱歉,您不能访问此页面”

  1. 在根目录wp-config.php这个文件中,添加代码:
  1. $_SERVER['HTTPS'] = 'on';
  2. define('FORCE_SSL_LOGIN', true);
  3. define('FORCE_SSL_ADMIN', true);

注:一定要放在if ( ! defined( ‘ABSPATH’ ) ) 之前

WordPress线上部署及更新主题 - 图2

  1. 数据库修改数据 http 改成 https

WordPress线上部署及更新主题 - 图3

更新主题

只需要更换该主题文件 wp-content/themes/主题名