-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Add note about enqueueing assets in the iframe and trim whitespace. #54125
Conversation
Conflicts. 😞 Happy to review once resolved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ndiego In the wp_enqueue_script
and wp_enqueue_style
function calls, they are terminated via );
but there is an existing }
on the following line. I believe this will cause a syntax error when executing this function. The closing }
for the function should be at the same indent level hints the last }
before the add_action
hook. The others should likely be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ndiego There is still a problem with this first code snippet.
/**
* Enqueue Editor assets.
*/
function example_enqueue_editor_assets() {
wp_enqueue_script(
'example-editor-scripts',
plugins_url( 'editor-scripts.js', __FILE__ ) );
}
wp_enqueue_style(
'example-editor-styles',
plugins_url( 'editor-styles.css', __FILE__ ) );
}
}
add_action( 'enqueue_block_editor_assets, 'example_enqueue_editor_assets' );
Rewrite to:
/**
* Enqueue Editor assets.
*/
function example_enqueue_editor_assets() {
wp_enqueue_script(
'example-editor-scripts',
plugins_url( 'editor-scripts.js', __FILE__ )
);
wp_enqueue_style(
'example-editor-styles',
plugins_url( 'editor-styles.css', __FILE__ )
);
}
add_action( 'enqueue_block_editor_assets, 'example_enqueue_editor_assets' );
Thanks @alexstine, and there was a missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
What?
Updates the Enqueueing assets in the Editor doc based on @ellatrix's feedback. While updating the doc, I also trimmed all extra whitespace.
Edit: in preparing this PR, a number of typos were also found and fixed.