我可以在 WordPress 中更改主题名称吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36120925/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I change the theme name in WordPress?
提问by Douglas Oliveira
How can I change the theme name in WordPress and where?
如何更改 WordPress 中的主题名称以及在哪里?
Can I also change the folder name theme1244 in public/wp-content/themes/theme1244
without having problems in the future?
我以后也可以更改文件夹名称 theme1244public/wp-content/themes/theme1244
吗?
回答by Shady Alset
Step 1: Firstly go to wp-content/themes/
folder. And then rename your theme folder to whatever you want.
步骤1:首先进入wp-content/themes/
文件夹。然后将您的主题文件夹重命名为您想要的任何名称。
Step 2: Open your theme folder and open style.css
file. In top part of style.css you will see theme name. Rename it and save changes.
第 2 步:打开您的主题文件夹并打开style.css
文件。在 style.css 的顶部,您将看到主题名称。重命名并保存更改。
Step 3: Go to Wp-admin/appearance/themes
and activate your theme under new name.
第 3 步:转到Wp-admin/appearance/themes
并以新名称激活您的主题。
If you are using child/parent theme and you also rename parent theme folder&name, so after Step 3 you should additionally change parent theme path in child theme's style.css
.
如果您正在使用子/父主题并且您还重命名父主题文件夹和名称,那么在第 3 步之后,您应该另外更改子主题的style.css
.
note : renaming your theme will stop its automatic updates, you should do it manually in the future.
注意:重命名您的主题将停止其自动更新,您应该在将来手动进行。
回答by cursedphil
You can absolutely change the name of the folder without having any problems. If you want to change just the themes name, open the style.css in the root folder of your theme and edit the name in the comments at the top of the file. If you plan on doing more changes, you might be better off creating a child theme: https://codex.wordpress.org/Child_Themes
您绝对可以毫无问题地更改文件夹的名称。如果您只想更改主题名称,请打开主题根文件夹中的 style.css 并在文件顶部的注释中编辑名称。如果您打算进行更多更改,最好创建一个子主题:https: //codex.wordpress.org/Child_Themes
回答by Svetlin Nakov
All the above is correct, but is not enough. After you rename the theme, e.g. rename the folder old-theme
--> new-theme
, you should copy the theme customizations(colors, header / footer, widgets, etc.) from the old theme to the new theme. This is done directly in the MySQL database:
以上都是正确的,但还不够。重命名主题后,例如重命名文件夹old-theme
--> new-theme
,您应该将主题自定义(颜色、页眉/页脚、小部件等)从旧主题复制到新主题。这是直接在 MySQL 数据库中完成的:
- Find an option named
theme_mods_old-theme
in the tablewp_options
- Copy the
option_value
(it is a text holding the theme customizations in a special WordPress format) - Put the copied value in a new option named
theme_mods_new-theme
in thewp_options
table.
- 查找
theme_mods_old-theme
表中命名的选项wp_options
- 复制
option_value
(它是以特殊的 WordPress 格式保存主题自定义的文本) - 将复制的值放在表中命名的新选项
theme_mods_new-theme
中wp_options
。
回答by Curtis M
I changed my theme name in wp-content/themes/{your site name folder}/style.css I am using a child theme
我在 wp-content/themes/{your site name folder}/style.css 中更改了我的主题名称 我正在使用子主题
/*
Theme Name: WhateverYouWantToNameIT
Template: twentytwenty
*/
回答by Hitesh Prajapati
Its absolutely easy and simple, just follow instruction
1. Just rename theme name with your desire theme name.
2. open your desire theme name and open style.css file, and find theme name and changes with your desire theme name.
3. you can see your desire theme in admin dashboard-> appearance-> themes, just select and activate it.
它绝对简单易行,只需按照说明
1. 只需使用您想要的主题名称重命名主题名称即可。
2.打开你想要的主题名称,打开style.css文件,找到主题名称,并根据你想要的主题名称进行更改。
3.您可以在管理仪表板->外观->主题中看到您想要的主题,只需选择并激活它即可。