Vextor-ltd
@Vextor-ltd
Webdeveloper

Почему не подключаются javascript-скрипты в head?

Почему не подключаются javascript-скрипты в head?

В :
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title><?php bloginfo('description'); ?></title>

  <?php wp_head() ?>

</head>


functions.php:
<?php
add_action('wp_enqueue_scripts', 'my_style');
add_action('wp_enqueue_scripts', 'my_scripts');
add_action('admin_init', 'disable_content_editor'); // Отключаем редактор страниц в админке поскольку используем ACF

function my_style() {
  wp_enqueue_style('main-style', get_stylesheet_uri());
}

function my_scripts() {
  wp_enqueue_script('main-script', get_template_directory_uri() . '/assets/js/main.min.js', array(), null, true);
}

function disable_content_editor() {
  if (isset($_GET['post'])) {
    $post_ID = $_GET['post'];
  } else if (isset($_POST['post_ID'])) {
    $post_ID = $_POST['post_ID'];
  }

  if (!isset($post_ID) || empty($post_ID)) {
    return;
  }

  $disabled_IDs = array(2);
  if (in_array($post_ID, $disabled_IDs)) {
    remove_post_type_support('page', 'editor');
  }
}

require get_template_directory() . '/functions/ajax-more-news.php';


Удивительно то, что теги со скриптами подключаются только в Firefox, а в других браузерах нет. WTF?
  • Вопрос задан
  • 48 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы