Can you clarify what situation you are using wp_enqueue_script/style in?
If you add CSS or JS snippets, they are enqueued for you using wp_enqueue_* and an automatically generated src URL.
Thanks Shea,
* “If you add CSS or JS snippets, they are enqueued for you using wp_enqueue_* and an automatically generated src URL.” << Can you provide an example of such an auto-generated src URL?
* “Can you clarify what situation you are using wp_enqueue_script/style in?” << This is a specific example. In the tutorial, the main function is saved as an external script sheet called “global.js” which is then enqueued.
Many thanks!
Hi Shea,
Just following up on this ticket.
Many thanks!
Actually, upon further investigation, I think my original question was misguided. I can see that anything put in a CSS snippet is loaded into a separate “query-string-modified-homepage file” (of the form: yourdomain.com/?code-snippets-css=1), and anything put in a JS snippet is loaded into, yet again, a separate “query-string-modified-homepage file” (of the form either: yourdomain.com/?code-snippets-js-snippets=head or yourdomain.com/?code-snippets-js-snippets=footer, depending on the load location).
So when you say:
If you add CSS or JS snippets, they are enqueued for you using wp_enqueue_* and an automatically generated src URL.
…do you mean that anything put inside JS snippets are loaded into the aforementioned “file”, and then enqueued via the wp_enqueue_scripts function and hook, something like this:
function my_scripts_method() {
wp_enqueue_script( 'my-script', get_home_url . '/code-snippets-js-snippets=header');
}
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
So the stylesheet/script inside the CSS/JS snippet is already enqueued by the way this plugin is designed. Got it.
Will now close this ticket.