Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #24283

    Hi,

    I’m getting this error each time I try to add something to the cart :

    PHP Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /public_html/wp-includes/functions.php on line 2959

    Thanks

    #123006

    PHP Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the <cod>wp_enqueue_scripts</cod>, <cod>admin_enqueue_scripts</cod>, or <cod>init</cod> hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in public_html/wp-includes/functions.php on line 2959

    #123007

    Hi,

    Edit woocommerce-config > config.php then find this code

    function avia_woocommerce_register_assets()
    {
    wp_enqueue_style( 'avia-woocommerce-css', AVIA_BASE_URL.'woocommerce-config/woocommerce-mod.css');
    wp_enqueue_script( 'avia-woocommerce-js', AVIA_BASE_URL.'woocommerce-config/woocommerce-mod.js', array('jquery'), 1, true);
    }

    Replace it with

    function avia_woocommerce_register_assets()
    {
    wp_enqueue_script( 'avia-woocommerce-js', AVIA_BASE_URL.'woocommerce-config/woocommerce-mod.js', array('jquery'), 1, true);
    wp_enqueue_style( 'avia-woocommerce-css', AVIA_BASE_URL.'woocommerce-config/woocommerce-mod.css');
    }

    Regards,

    Ismael

    #123008

    Hi,

    Thank you for your help.

    With WP DEBUG ON I’m toujours having this in the debug.log :

    [05-Jun-2013 07:47:44 UTC] PHP Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the <cod>wp_enqueue_scripts</cod>, <cod>admin_enqueue_scripts</cod>, or <cod>init</cod> hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/dpmderek/public_html/wp-includes/functions.php on line 2959

    #123009

    Hey!

    Are you sure that these errors are triggered by Abundance? I see no reference to a theme file.

    Regards,

    Peter

    #123010

    Well I do have this line coming right after the first warning :

    [05-Jun-2013 09:55:25 UTC] PHP Notice: Undefined offset: 1 in /home/dpmderek/public_html/wp-content/themes/abundance/framework/php/function-set-avia-frontend.php on line 1035

    But it’s only a php notice so you might be right.

    #123011

    This is other messages :

    [05-Jun-2013 09:57:26 UTC] PHP Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/dpmderek/public_html/wp-includes/functions.php on line 2959

    [05-Jun-2013 09:57:30 UTC] PHP Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/dpmderek/public_html/wp-includes/functions.php on line 2959

    [05-Jun-2013 09:57:47 UTC] PHP Notice: wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home/dpmderek/public_html/wp-includes/functions.php on line 2959

    [05-Jun-2013 09:57:47 UTC] PHP Notice: Undefined property: WP_Query::$post in /home/dpmderek/public_html/wp-includes/query.php on line 3017

    [05-Jun-2013 09:57:47 UTC] PHP Notice: Trying to get property of non-object in /home/dpmderek/public_html/wp-includes/query.php on line 3385

    [05-Jun-2013 09:57:47 UTC] PHP Notice: Trying to get property of non-object in /home/dpmderek/public_html/wp-includes/query.php on line 3387

    [05-Jun-2013 09:57:47 UTC] PHP Notice: Trying to get property of non-object in /home/dpmderek/public_html/wp-includes/query.php on line 3389

    [05-Jun-2013 09:57:47 UTC] PHP Notice: Trying to get property of non-object in /home/dpmderek/public_html/wp-includes/link-template.php on line 243

    [05-Jun-2013 09:57:47 UTC] PHP Notice: Trying to get property of non-object in /home/dpmderek/public_html/wp-includes/link-template.php on line 248

    #123012

    [05-Jun-2013 09:55:25 UTC] PHP Notice: Undefined offset: 1 in /home/dpmderek/public_html/wp-content/themes/abundance/framework/php/function-set-avia-frontend.php on line 1035

    If you want to fix this warning open up and replace

    $i = count($matches['browser']);
    if ($i != 1) {
    //we will have two since we are not using 'other' argument yet
    //see if version is before or after the name
    if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){
    $version = $matches['version'][0];
    }
    else {
    $version= $matches['version'][1];
    }
    }
    else {
    $version= $matches['version'][0];
    }

    with

    $i = count($matches['browser']);
    if ($i != 1) {
    //we will have two since we are not using 'other' argument yet
    //see if version is before or after the name
    if (strripos($u_agent,"Version") < strripos($u_agent,$ub)){
    $version = !empty($matches['version'][0]) ? $matches['version'][0] : '';
    }
    else {
    $version= !empty($matches['version'][1]) ? $matches['version'][1] : '';
    }
    }
    else {
    $version= !empty($matches['version'][0]) ? $matches['version'][0] : '';
    }

    (although the warning won’t affect you or the frontend users). The other php notices are imo not related to the theme code.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘wp_enqueue_style issue’ is closed to new replies.