Support » Plugins » wp_enqueue_style & conditionals.. not working

  • I got the following situation: I want to add wp_enqueue_style for a stylesheet for only ex. lte IE 7. (WP_DEBUG in wp-config.php is true)

    Szenario 1)

    add_action('hook_ie_styles', wp_enqueue_style( 'my_ie_stylesheet', SOMEPATHCONSTANT . '/ie.css', false, '0.0', 'screen' ), 100 );

    Problem: Php-Notice:

    <b>Notice</b>: Undefined offset: 0 in <b>C:\development\xampp\htdocs\wordpress\wp-includes\plugin.php</b> on line <b>747</b>

    <b>Notice</b>: Undefined offset: 0 in <b>C:\development\xampp\htdocs\wordpress\wp-includes\plugin.php</b> on line <b>765</b>

    Szenario 2)

    function load_ie_style() {
     wp_enqueue_style( 'my_ie_stylesheet', SOMEPATHCONSTANT . '/ie.css', false, '0.0', 'screen' );
    global $wp_styles;
    $wp_styles->add_data( 'my_ie_stylesheet', 'conditional', 'lte IE 7' );
    add_action('hook_ie_styles', 'load_ie_style', 100);

    Problem: Stylesheet get’s loaded, but not with conditionals (in this ex. context: Not restricted for lte IE 7).

    What’s the problem in here? Do i have to live with the error notice because of the offset to keep this running?

    Thanks for any answer!

  • The topic ‘wp_enqueue_style & conditionals.. not working’ is closed to new replies.