Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you may not be able to execute some actions.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Хочу прицепить свой css к теме Wordpress, но получаю ошибку MIME.
В functions.php пишу:
<?php function enqueue_new_theme(){ //style wp_enqueue_style("custom", get_template_directory( ) . "/style.css", array(), "1.0.0", "all"); } add_action("wp_enqueue_scripts", "enqueue_new_theme");
А в итоге выходит ошибка:
Refused to apply style from because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Что делать, куда бежать?
Все по докам вроде, так я бы посмотрел на конфиг веб-сервера — для css он должен выдавать заголовки text/css все же.
Нет, не по докам. Во-первых, непонятно, что делает пробел в get_template_directory( ). Но это вроде не должно ломать. Во-вторых, эта функция возвращает абсолютный путь к папке, а не её урл. А тут нужен URL —
<?php function enqueue_new_theme(){ //style wp_enqueue_style("custom", get_template_directory_uri() . "/style.css", array(), "1.0.0", "all"); } add_action("wp_enqueue_scripts", "enqueue_new_theme");
Ага, вот оно что, спасибо, вроде работает правильно.