Support » Fixing WordPress » wp_enqueue_scripts for stylesheets not working

  • Resolved creariz


    I´ve been reading a lot to try to solve this problem, and right now I really don´t know what´s wrong.

    I have the following code inside my functions.php and it doesn´t work. It causes the webpage not to load. If I delete it the webpage works perfectly.

    function add_my_stylesheets() {
    	if(!is_login() && !is_admin()) {
    		wp_register_style(style-general', get_stylesheet_directory_uri() . '/includes/css/style-general.css');
    		wp_register_style(style-ltie9', get_stylesheet_directory_uri() . '/includes/css/style-ltie9.css');
    		wp_register_style(style-ltie8', get_stylesheet_directory_uri() . '/includes/css/style-ltie8.css');
    		$GLOBALS['wp_styles']->add_data( style-ltie9', 'conditional', 'lt IE 9' );
    		$GLOBALS['wp_styles']->add_data( style-ltie8', 'conditional', 'lt IE 8' );

    I would appreciate some help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Have you tried echoing anything inside the if statement to check that it’s actually working?

    Thank you James. That was the actual solution to the problem. I really didn´t need the condition, cause wp_enqueue_scripts doesn´t run on admin pages or the login. Everything is working now.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_enqueue_scripts for stylesheets not working’ is closed to new replies.