Twenty Twenty child theme

  • Unknown's avatar

    Hi,
    I’m having some troubles creating a child theme based on Twenty Twenty theme.
    After creating twentytwenty-child folder in “theme”, setting up function.php and style.css in it and setting the child theme on the backend, I can’t get it working.

    These are my style.css and function.php in my “twentytwenty-child” folder:

    style.css

    /*
     Theme Name:   Twenty Twenty Child
     Theme URI:    http://example.com/twenty-fifteen-child/
     Description:  Twenty Twenty Child Theme
     Author:       lup0z
     Author URI:   http://example.com
     Template:     twentytwenty
     Version:      1.0.0
     License:      GNU General Public License v2 or later
     License URI:  http://www.gnu.org/licenses/gpl-2.0.html
     Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
     Text Domain:  twentytwentychild
    */
    

    function.php

    <?php
    
    	add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    	function my_theme_enqueue_styles() {
    	    $parenthandle = 'twentytwenty-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
    	    $theme = wp_get_theme();
    	    wp_enqueue_style( $parenthandle, get_template_directory_uri() . '/style.css', 
    	        array(),  // if the parent theme code has a dependency, copy it to here
    	        $theme->parent()->get('Version')
    	    );
    	    wp_enqueue_style( 'twentytwentychild-style', get_stylesheet_uri(),
    	        array( $parenthandle ),
    	        $theme->get('Version') // this only works if you have Version in the style header
    	    );
    	}
    	
    ?>
    

    I’ve spent a lot of time searching for a solution in various websites, but I can’t make it work.

    Thank you for your reply

  • Unknown's avatar

    It looks you are in the wrong forum as you can’t set up a child theme on the free wordpress.com platform. If your site uses the open source wordpress.org, their support is at https://wordpress.org/support/

  • Unknown's avatar

    I’m so sorry for this misunderstanding.
    Thank you for your reply!

  • The topic ‘Twenty Twenty child theme’ is closed to new replies.