Bumptop主题:如何通过主题森林为报纸主题创建子主题

我创建了两个文件:

style.css
functions.php

两者都在压缩文件夹Newspaper-child中。

style.css:
Theme Name: Newspaper Child
Template: Newspaper
*/
functions.php:
<?php
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');
function my_theme_enqueue_styles() {
    $parent_style = 'parent-style'; // This is 'twentyfif-style' for the Twenty Fif theme.
    wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css');
    wp_enqueue_style('child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array($parent_style),
        wp_get_theme()->get('Version')
    );
}
?>

当我使用子主题时,它完全弄乱了我的网站。

2

删除对“parent-style”的依赖项。改用此代码。

add_action( 'wp_enqueue_scripts', 'child_enqueue_styles');
function child_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css', array(), '1.0');
}
0
<?php

函数 my_theme_enqueue_styles () {

add_action( 'wp_enqueue_scripts', 'child_enqueue_styles');

函数 child_enqueue_styles () {

wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css', array(), '1.0');

} wp_enqueue_style ($parent_style,get_template_directory_uri ().'/ style.css');wp_enqueue_style ('child-style',get_stylesheet_directory_uri ().'/ style.css',array ($parent_style

现在还好吗?

本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处

(188)
云服务器搭建云电脑:云服务器厂商如何实现云服务器
上一篇
玩客云打印机服务器:通过树莓派设置打印机服务器时 我的打印机不打印文档
下一篇

相关推荐

  • lifestart.syaro网页版Lifestart.syaro网页版

    lifestart.syaro是一个基于Web的轻量级社交网络服务,它提供了一种方便快捷的方式来分享、交流和发布内容。它的核心功能包括:…

    2023-09-16 14:53:15
    0 74 19
  • S sts:按STS令牌年龄限制S3存储桶访问 (token age)

    关于S sts的问题,在token age中经常遇到,我有一个 S3 存储桶,我想根据用于访问它的凭证的年龄来限制访问。例如,如果用于访问存储桶的令牌大于 X 天,我想拒绝访问。我怎样才能实现这一点?像这样的政策-…

    2023-10-23 03:50:39
    0 27 99
  • 怎么让qq皮肤透明:你怎么让剑攻击(how to make sword)

    关于怎么让qq皮肤透明的问题,在how to make sword中经常遇到,你们是怎么进行剑攻的?我问这个问题是因为我不知道如何进行剑攻,而我正在观看的tutorial只显示了射弹攻击。我想学习如何为我正在创建的游戏进行剑攻。这是我正在显示的代码…

    2023-11-09 03:19:53
    0 79 34
  • Idea导入文件:IDEA无法重新导入 sbt项目

    关于Idea导入文件的问题,在extracting structure failed: build status: error中经常遇到,它经常发生在当前稳定版本的(社区)IDEA(2021.1.2)和 Scala 插件(2021.1.21),我在 Windows 下对 sbt 文件(例如 sbt 版本 1.5.3)进行更改,IDEA 显示它需要导入,但它失败了:…

    2023-10-28 06:30:48
    0 68 39

发表评论

登录 后才能评论

评论列表(50条)