Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress How to Make a Website with WordPress Customizing WordPress Themes How to Make Child Themes

Simone Berzi
Simone Berzi
5,064 Points

@import or a funcition php?

Hello, i read on the codex.wordpress.org that is better use into the style.css in the child theme folder this code: <?php

add_action( 'wp_enqueue_scripts', 'enqueue_parent_theme_style' ); function enqueue_parent_theme_style() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); }

than the @import for create the childtheme.

Can someone explame me why?

Thank you :)

1 Answer

It is better from a performance standpoint, the browser has to load the first style sheet, read it, realizing then that there is a second one to download, which is yet another request.

Here is more on the topic: https://kovshenin.com/2014/child-themes-import/