• I’m trying to create a child theme for my site, but the correct way is this now…

    @import should not be used to import the parent stylesheet into the child theme. The correct method is to use wp_enqueue_style() to enqueue the parent stylesheet, using this code in your child theme’s “functions.php”. You will need to create a functions.php in your child theme’s root folder (This is the only two files needed to create a child theme). Right at the start, on the first line, you should add an opening php tag. All other code will follow after this opening php tag

    I have some questions please…
    how do i create a PHP file – in Notepad or something?
    what are the two files needed – functions.php and the style.css from the parent?
    what’s an opening PHP tag?

    Please help, I’m still learning!
    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • Yes, create functions.php in a text editor – Notepad will do.

    functions.php contains PHP code that adds stuff to your site and style.css contains the CSS code that makes it look pretty!

    An opening php tag is <?php and the closing tag is ?>

    Thread Starter tuftyone

    (@tuftyone)

    thank you, so there’ll be two style.css files – one in the theme folder and one in the child theme folder?

    Yes.

    Have a good look round using your favourite search engine. Child themes are popular and there should be some good tutorials that will help you

    Thread Starter tuftyone

    (@tuftyone)

    thanks, there are some tutorials but they all seem to talk about using the @import function rather than the wp_enqueue_style one

    Thread Starter tuftyone

    (@tuftyone)

    right, I’m now getting

    Broken Themes

    The following themes are installed but incomplete. Themes must have a stylesheet and a template.

    Name Description
    Kronos Child The parent theme is missing. Please install the “kronos-WP” parent theme.
    Kronos-WP Stylesheet is missing.

    when i look for the new child theme in Themes.
    There is a style.css in the child theme directory containing this code:

    /*
    Theme Name: Kronos Child
    Description: Kronos Child Theme
    Author: John Doe
    Author URI: https://example.com
    Template: kronos-WP
    Version: 1.0.0
    Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
    Text Domain: kronos
    */

    /* =Theme customization starts here
    ————————————————————– */

    any help would be appreciated!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘child theme’ is closed to new replies.