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 trialAlexander Buchanan
5,156 PointsChild theme consistently showing error, unable to enqueue?
Hi there,
I am trying to create a child theme and consistently hitting a roadblock.
I have copied in the style.css, and also made a function.php file. The function.php file is located in the child theme folder, and contains only this code:
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' ); function enqueue_parent_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); }
However, when I go to edit the theme I am getting this error message:
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' ); function enqueue_parent_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); } Warning: Cannot modify header information - headers already sent by (output started at /home/sandybuc/public_html/wp-content/themes/the-huxley-child/functions.php:4) in /home/sandybuc/public_html/wp-content/plugins/wpclef/includes/lib/wp-session/class-wp-session.php on line 124
Warning: Cannot modify header information - headers already sent by (output started at /home/sandybuc/public_html/wp-content/themes/the-huxley-child/functions.php:4) in /home/sandybuc/public_html/wp-includes/pluggable.php on line 1228
What am I doing wrong? this is an unfortunately tiresome roadblock early on in the piece.
Any advice would be greatly appreciated!
1 Answer
Jacob Mishkin
23,118 PointsFor what I see it looks like you are using the wp_enqueue_scripts tag rather than the wp_enqueue_style tag. I think this video does a great job explaining the process: