You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To enqueue style.css:
wp_enqueue_style( 'style', get_stylesheet_uri() );
This will look for a stylesheet named “style” and load it.
Message I got from wordpress:
Notice: Function wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the style handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in wordpress/wp-includes/functions.php on line 6078
I'm not sure how we might want to address the current page since it will be deprecated/removed or integrated into the Classic Themes chapter as part of #816. The information isn't wrong. It just assume some preexisting knowledge about the correct hooks to use (this isn't the case with the newer doc).
Maybe, for now (at least until the Classic Themes chapter is overhauled), we should put an alert banner at the top of the page to redirect readers to the new doc??
Activity
github-actions commentedon Jun 2, 2024
Heads up @WordPress/docs-issues-coordinators, we have a new issue open. Time to use 'em labels.
github-actions commentedon Jun 3, 2024
Heads up @kafleg @carolinan @TeBenachi - the "themes" label was applied to this issue.
carolinan commentedon Jun 4, 2024
So how can readers be encouraged to continue reading and not only copy part of the code example?
cweiske commentedon Jun 4, 2024
I copied the whole example.
The section at the end of the page tells you that
- but even it does not tell you that all the previous examples were incomplete.
justintadlock commentedon Jun 5, 2024
The relevant documentation for including assets is here and includes more in-depth examples: https://developer.wordpress.org/themes/core-concepts/including-assets/
I'm not sure how we might want to address the current page since it will be deprecated/removed or integrated into the Classic Themes chapter as part of #816. The information isn't wrong. It just assume some preexisting knowledge about the correct hooks to use (this isn't the case with the newer doc).
Maybe, for now (at least until the Classic Themes chapter is overhauled), we should put an alert banner at the top of the page to redirect readers to the new doc??
estelaris commentedon Jun 6, 2024
@justintadlock that is a good solution. Are you able to update the article?
justintadlock commentedon Jun 6, 2024
Updated and added an alert box to go to the newer doc: https://developer.wordpress.org/themes/basics/including-css-javascript/
cweiske commentedon Jun 7, 2024
Thank you.