How to Fix Common Twenty Fourteen Child Theme Issues: Styles, Scripts, and Layout
Content
Creating a child theme for the Twenty Fourteen theme is a best practice for making customizations that survive theme updates. However, many users encounter a specific set of problems when setting one up. Based on community reports, the most frequent issues involve stylesheets not loading, layout breaking, and custom functions not working as expected.
Why These Problems Happen
The root cause of most issues is the shift away from using the @import method in the child theme's style.css to load the parent theme's styles. Modern browsers can block this method, leading to a site with no styling. Furthermore, child themes require a specific structure and correct enqueuing of scripts and styles to function properly. Customizations like header images or widget areas are stored in the database and are tied to the specific theme that was active when they were set, so they must be reconfigured after switching to a child theme.
Common Solutions
1. Correctly Enqueue Parent and Child Theme Styles
The most common solution is to replace the outdated @import rule with a proper enqueuing method in the child theme's functions.php file. This ensures all of the parent theme's styles and their dependencies are loaded correctly.
Recommended code for your child theme's functions.php:
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
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' )
);
}
?>
This code loads the parent stylesheet first, then your child theme's stylesheet, which depends on it. The 'genericons' font dependency from the parent theme is automatically handled by this method.
2. Reconfigure Theme Settings
Settings for the custom header, background, menus, and widget areas are not automatically transferred from the parent theme to the child theme. After activating your child theme, you must revisit Appearance → Header, Appearance → Background, and Appearance → Menus to reconfigure these options.
3. Handle Additional CSS Files
If your parent theme loads additional stylesheets (like ie.css or editor-style.css), they are automatically enqueued by the parent theme's functions. You do not need to enqueue them again in your child theme. The provided code above is sufficient. Attempting to re-enqueue them can cause errors.
4. Troubleshoot Layout and RTL Issues
If your site's layout appears broken or reversed (right-to-left), first ensure your functions.php code is correct and does not contain errors. A common mistake is incorrectly enqueuing multiple stylesheets with the same handle. Verify that the @import rule has been completely removed from your child theme's style.css file.
5. Check for File and Path Errors
If your browser console shows "Failed to load resource" errors for images, it is likely because you copied the entire parent style.css into your child theme. Image paths in CSS are relative. The solution is to only keep your custom CSS in the child theme's stylesheet and use the enqueuing method, or copy the necessary image folders from the parent theme to your child theme directory.
Final Checklist
- Child theme folder is in
/wp-content/themes/. - Child theme's
style.csscontains a valid header withTemplate: twentyfourteen. - The
@importrule is removed fromstyle.css. - The
functions.phpfile uses thewp_enqueue_scriptsaction as shown above. - Theme settings (headers, backgrounds, menus) have been reconfigured under the child theme.
- Browser cache has been cleared after making changes.
By following these steps, you should be able to resolve the most common issues encountered when creating a Twenty Fourteen child theme.
Related Support Threads Support
-
Child Themehttps://wordpress.org/support/topic/child-theme-124/
-
Appearance of Child Themhttps://wordpress.org/support/topic/appearance-of-child-them/
-
Exact code to put in Child themes functions.php for enqueueing all stylesheetshttps://wordpress.org/support/topic/exact-code-to-put-in-child-themes-functionsphp-for-enqueueing-all-stylesheets/
-
Twenty Fourteen Template changeshttps://wordpress.org/support/topic/twenty-fourteen-template-changes/
-
Child Theme not workinghttps://wordpress.org/support/topic/child-theme-not-working-31/
-
Child theme not showing changeshttps://wordpress.org/support/topic/child-theme-not-showing-changes/
-
Create a Child Theme but lose header graphicshttps://wordpress.org/support/topic/create-a-child-theme-but-lose-header-graphics/
-
Child theme breaks the sitehttps://wordpress.org/support/topic/child-theme-breaks-the-site/
-
How to enqueue CSS styles in Twentyfourteen child theme?https://wordpress.org/support/topic/how-to-enqueue-css-styles-in-child-theme/
-
Child Theme on Twenty Fourrteen does not activate csshttps://wordpress.org/support/topic/child-theme-on-twenty-fourrteen-does-not-activate-css/
-
Custom blog section – which files do i edit?https://wordpress.org/support/topic/custom-blog-section-which-files-do-i-edit/
-
Editing the Footer using Functions.phphttps://wordpress.org/support/topic/editing-the-footer-using-functions-php/
-
Managing changes to style.css in twentyfourteenhttps://wordpress.org/support/topic/managing-changes-to-stylecss-in-twentyfourteen/
-
Issue with Child Theme and Parent Theme pagehttps://wordpress.org/support/topic/issue-with-child-theme-and-parent-theme-page/
-
Changing the php functions in a child themehttps://wordpress.org/support/topic/changing-the-php-functions-in-a-child-theme/
-
This Theme (Child) and WooCommercehttps://wordpress.org/support/topic/this-theme-child-and-woocommerce/
-
Problem creating child themehttps://wordpress.org/support/topic/problem-creating-child-theme-1/
-
mod_pagespeed and @importhttps://wordpress.org/support/topic/mod_pagespeed-and-import/
-
Twenty Fourteen- how to create a child themehttps://wordpress.org/support/topic/twenty-fourteen-how-to-create-a-child-theme/
-
Twenty Fourteen- how to hide left menu subpages?https://wordpress.org/support/topic/twenty-fourteen-how-to-hide-left-menu-subpages/
-
child theme – is this right?https://wordpress.org/support/topic/child-theme-is-this-right/
-
Problem making custom pagetemplate with postshttps://wordpress.org/support/topic/problem-making-custom-pagetemplate-with-posts/
-
child themehttps://wordpress.org/support/topic/child-theme-115/
-
Failed to load resource in child theme (image)https://wordpress.org/support/topic/failed-to-load-resource-in-child-theme-image/
-
Remove IE 9 csshttps://wordpress.org/support/topic/remove-ie-9-css/
-
Twenty fourteen child theme problemhttps://wordpress.org/support/topic/twenty-fourteen-child-theme-problem/
-
Child theme mess it uphttps://wordpress.org/support/topic/child-theme-mess-it-up/
-
Child Theme – Modify parent theme template file located in subfolderhttps://wordpress.org/support/topic/child-theme-modify-parent-theme-template-file-located-in-subfolder/
-
functions.php child themehttps://wordpress.org/support/topic/functionsphp-child-theme/
-
function in function.php not pluggable.https://wordpress.org/support/topic/function-in-functionphp-not-pluggable/
-
Adding Javascript to child-themehttps://wordpress.org/support/topic/adding-javascript-to-child-theme/