0

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.

1
  • Turn on debugging.
    – Wyck
    Jun 29, 2014 at 18:07

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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