function renderProductPageUi() {
wp_enqueue_style('stylesheetHandle', plugins_url('pluginName/semantic/dist/semantic.css'));
require_once ('templates/offerBox.php');
}
add_action('woocommerce_after_add_to_cart_button', 'renderProductPageUi');
In Chrome browser I see this red console error:
http://localhost/wptest2/wp-content/plugins/pluginName/semantic/dist/semantic.css?ver=5.1.1
SyntaxError: Invalid or unexpected token
Notice the ?ver=5.1.1
at the end. I vaguely recall this being a wordpress behavior. Is that what is causing the console error? If so how should it be corrected?
function renderProductPageUi() {
wp_enqueue_style('stylesheetHandle', plugins_url('pluginName/semantic/dist/semantic.css'));
require_once ('templates/offerBox.php');
}
add_action('woocommerce_after_add_to_cart_button', 'renderProductPageUi');
In Chrome browser I see this red console error:
http://localhost/wptest2/wp-content/plugins/pluginName/semantic/dist/semantic.css?ver=5.1.1
SyntaxError: Invalid or unexpected token
Notice the ?ver=5.1.1
at the end. I vaguely recall this being a wordpress behavior. Is that what is causing the console error? If so how should it be corrected?
1 Answer
Reset to default 2To elaborate on my comment: SyntaxError: Invalid or unexpected token
is not an error that you will ever see related to CSS. This is a JavaScript error that occurs when there's a syntax error in some JavaScript. If you see this error and it's occurring in a CSS file, then it means that you have improperly loaded a CSS file in <script>
tag, which means the browser will try to parse the CSS as JavaScript, which will inevitably produce a syntax error, because CSS is not valid JavaScript.
This will happen in WordPress if you try to use wp_enqueue_script()
on a CSS file. Make sure you only use wp_enqueue_script()
for JavaScript files, and wp_enqueue_style()
for CSS files.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745097105a4611045.html
wp_enqueue_script()
for the semantic.js file but forgot to change the extension – Sean D Commented Oct 8, 2019 at 10:00