douweng1935 2019-07-17 21:42
浏览 45

无法创建Wordpress子主题

So I'm trying to create a child theme called premierpas from the wordpress theme "fullscreen-agency". I create the premierpas folder in the themes, then I added a css file with that content :

/*
 Theme Name:   Premier Pas
 Author:       Garga Le Noir
 Template:     fullscreen-agency
 Version:      1.0.0
*/

and a functions.php with this content :

<?php
function premierpas_enqueue_styles() {

    $parent_style = 'fullscreen-agency';

    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 ),null);
}

I've tried quite a few other versions of the functions code, without success. When I try to activate it, my website just breaks. I only have a message telling me there is a technical problem, and I get an email to activate the recovery mode. I'm sure the error is trivial and I'm sorry if I'm wasting your time, but I'm quite stuck on this... Any help will be appreciated, thanks in advance

  • 写回答

1条回答 默认 最新

  • douzhun8615 2019-07-17 23:33
    关注

    I created a child theme with the code you stated above and it worked for me. The one change I made was I set the parent to be twentyfifteen since I didn't have your fullscreen-agency parent theme. I assumed your file paths were...

    wp-content/themes/premierpas/style.css
    wp-content/themes/premierpas/functions.php
    

    A couple things to try...

    1. Remove your functions.php file. If that solves the issue then perhaps you already have premierpas_enqueue_styles() defined in your parent theme or there is some related error.
    2. Enable the debug.log by adding the following to your wp-config.php file... define( 'WP_DEBUG', true ); then try reactivating the child theme and look at your wp-content/debug.log file to see if there are any relevant errors thrown that can help you troubleshoot further.
    评论

报告相同问题?

悬赏问题

  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害