Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I created a child theme and created a functions.php file in the child theme directory that also has the required style.css file and a seperate custom CSS file that I want to load. This is the code I use:

<? php 

add_action('wp_head', 'add_landing_css');
function add_landing_css() {

wp_enqueue_style('landing_css', get_stylesheet_directory_uri().'/landing.css','screen');
}
?>

When I add this code to functions.php every page on my website is blank. It doesn't load anything. When I delete functions.php file my website works as normal. I use a theme called Modest from elegant themes.

share|improve this question
    
Turn on debugging. –  Wyck Jun 29 at 18:07

1 Answer 1

up vote 0 down vote accepted

The reason for the syntax error is this typo:

<? php 

It should be

<?php 

Secondly, you should use the wp_enqueue_scripts hook instead of the wp_head hook.

Check out the Codex for more info on the wp_enqueue_scripts hook.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.