Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

How to make a child theme in wordpress ?

#Step 1:Create a child theme folder 
#Step 2: Create a stylesheet file: style.css
//[ add below code inside style.css ]
/*
 Theme Name:   Twenty Twenty Child
 Theme URI:    https://example.com/twenty-twenty-child/
 Description:  Twenty Twenty Child Theme
 Author:       John Doe
 Author URI:   https://example.com
 Template:     twentytwenty
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  https://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twentytwentychild
*/

The following information is must required:
01.Theme Name – needs to be unique to your theme
02. Template – the name of the parent theme directory. The parent theme in our example is the Twenty Twenty theme, so the Template will be twentytwenty. You may be working with a different theme, so adjust accordingly.

#Step 3: Create a function file: functions.php

#Step 4: Enqueue stylesheet: The final step is to enqueue the parent and child theme stylesheets if needed.
//[add below code inside functions.php]

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
    wp_enqueue_style( 'child-style', get_stylesheet_uri(),
        array( 'parenthandle' ), 
        wp_get_theme()->get('Version') // this only works if you have Version in the style header
    );
}

#Step 5: Install child theme
#Step 6: Activate child theme
Source by blog.stackfindover.com #
 
PREVIOUS NEXT
Tagged: #How #child #theme #wordpress
ADD COMMENT
Topic
Name
9+2 =