【问题标题】:wordpress custom theme not appearing in dashboardwordpress 自定义主题未出现在仪表板中
【发布时间】:2022-01-25 07:14:03
【问题描述】:

所以我是 wordpress 的新手,我刚刚在我的 wp-content/themes/mytheme 中为我的 wordpress 项目创建了一个自定义主题,我在新主题中添加了一个 index.php、blog.css 和一个 style.css 文件但是当我转到仪表板中的主题,新创建的主题未显示为选项。 我还缺少什么? 谢谢

style.css

/*
Theme Name: Start WordPress
Theme URI: http://wordpress.org/themes/startwordpress
Author: Me
Author URI: http://wordpress.org/
Description: The Start WordPress theme is my first custom theme.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: bootstrap, black, brown, orange, tan, white, yellow, light, one-
column, two-columns, right-sidebar, flexible-width, custom-header, 
custom-menu, editor-style, featured-images, microformats, post-
formats, rtl-language-support, sticky-post, translation-ready
Text Domain: startwordpress

This theme, like WordPress, is licensed under the GPL .
Use it to make something cool, have fun, and share what you've learned   
with others.
*/

【问题讨论】:

    标签: php html css wordpress wordpress-theming


    【解决方案1】:

    只是为了好玩。不要添加 blog.css。

    只需使用 style.css 和基本文件,直到您可以看到它。在进行故障排除时 - 只需使用 index.php 和 style.css - 并保持简洁。

    https://codex.wordpress.org/Theme_Development#Basic_Templates

    /*
    Theme Name: Example theme name
    Theme URI: n/a
    Author: you
    Author URI: n/a
    Description: example description...
    Version: 1.0
    License: GNU General Public License v2 or later
    License URI: http://www.gnu.org/licenses/gpl-2.0.html
    Tags: example-tag
    */
    

    当一个主题没有出现时,在主题管理中经常会出现如下所示的错误。

    【讨论】:

      【解决方案2】:

      除了图像和 JavaScript 文件之外,WordPress 主题通常由三种主要类型的文件组成。

      1 .style.css 样式表,用于控制网站页面的呈现方式(视觉设计和布局)。

      2 .WordPress 模板文件,用于控制网站页面从 WordPress 数据库生成信息以显示在网站上的方式。

      3 .可选的函数文件 (functions.php) 作为 WordPress 主题文件的一部分。

      示例:-

      按照 wp-content > 主题的路径到达您的主题文件夹。您将看到 WordPress 默认主题 - 二十五、二十四、二十三 - 和 index.php。为您的主题创建一个新目录;我打电话给我的startwordpress。

      /*
      Theme Name: Start WordPress
      Author: Tania Rascia
      Description: Bootstrap Blog template converted to WordPress
      Version: 0.0.1
      Tags: bootstrap
      */
      

      只需点击此链接https://www.taniarascia.com/developing-a-wordpress-theme-from-scratch/

      【讨论】:

      • 这是我下面的例子,所以我不知道从哪里开始,因为主题没有出现,我跟着这个教程。 @Arun
      【解决方案3】:

      检查主题文件是否具有正确的文件权限和所有权。

      CD 到您网站的根目录,如果您的服务器在 Ubuntu 上运行 Apache,则所有权可以设置为: chown www-data:www-data -R *

      或者对于 CentOS 上的 Apache: chown apache:apache -R *

      以及权限:

      找到 . -type d -exec chmod 755 {} \; # 更改目录权限

      找到 . -type f -exec chmod 644 {} \; # 修改文件权限

      【讨论】:

        【解决方案4】:

        如果您有多站点设置,则需要在我的站点->网络管理->主题中启用主题

        【讨论】:

          【解决方案5】:

          把包含主题信息的样式文件带进去

          【讨论】:

            猜你喜欢
            • 2023-01-12
            • 2012-09-03
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2011-07-29
            • 2011-12-11
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多