How to create a child theme

Before editing a theme, it is recommanded to create a child theme that will not be deleted at each update. You can have the complete instructions in the codex.


  • Create a new directory in your theme directory (ex twentyfourteen-child)
  • Create a new css file that will override the parent stylesheet and put the following code :
 Theme Name:   Twenty Fourteen Child
 Theme URI:
 Description:  Twenty Fourteen Child Theme
 Author:       John Doe
 Author URI:
 Template:     twentyfourteen
 Version:      1.0.0
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twenty-fourteen-child

/* =Theme customization starts here
-------------------------------------------------------------- */

Create a functions.php file (load before the parent theme functions.php file) with :


<?php // Opening PHP tag - nothing should be before this, not even whitespace

//To load parent theme style
add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX);
function enqueue_child_theme_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    wp_enqueue_style( 'child-style', get_stylesheet_uri(), array('parent-style')  );

// Custom Function to Include 
function favicon_link() { echo '<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />' . "\n"; } add_action( 'wp_head', 'favicon_link' );


  • Template Files: If you want to change more than just the stylesheet, your child theme can override any file in the parent theme: simply include a file of the same name in the child theme directory, and it will override the equivalent file in the parent theme directory when your site loads
Posted in Wordpress Tagged with:
0 comments on “How to create a child theme
1 Pings/Trackbacks for "How to create a child theme"
  1. […] Create a child theme (see How to create a child theme) […]

Leave a Reply