Для подключения стилей и скриптов используется метод create класса SP_Framework_Enqueue.
Давайте теперь проанализируем учебный шаблон html.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<!-- Stylesheets ============================================= --> <link rel="stylesheet" href="css/bootstrap.css" type="text/css" /> <link rel="stylesheet" href="style.css" type="text/css" /> <link rel="stylesheet" href="css/swiper.css" type="text/css" /> <link rel="stylesheet" href="css/dark.css" type="text/css" /> <link rel="stylesheet" href="css/font-icons.css" type="text/css" /> <link rel="stylesheet" href="css/animate.css" type="text/css" /> <link rel="stylesheet" href="css/responsive.css" type="text/css" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <!-- External JavaScripts ============================================= --> <script src="js/jquery.js"></script> <script src="js/swiper.js"></script> <script src="js/owl.carousel.js"></script> <script src="js/superfish.js"></script> <script src="js/jRespond.js"></script> <script src="js/js.cookie.js"></script> <script src="js/jquery.appear.js"></script> <script src="js/jquery.plugin.js"></script> <script src="js/jquery.countTo.js"></script> <script src="js/animsition.js"></script> <script src="js/jquery.flexslider.js"></script> <script src="js/jquery-ui.js"></script> <!-- Header Scripts ============================================= --> <script src="js/scripts.js"></script> |
И в том же порядке подключим css и js файлы. Код нужно будет добавить в файл enqueue.php шаблона SP Theme
Вот что должно получится:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
<?php $spMC = new SP_Framework_Enqueue(); $args = array( 'css' => array( array( 'name' => 'bootstrap', 'path' => '/assets/css/bootstrap.css', ), array( 'name' => 'style', 'path' => '/assets/css/style.css', ), array( 'name' => 'swiper', 'path' => '/assets/css/swiper.css', ), array( 'name' => 'dark', 'path' => '/assets/css/dark.css', ), array( 'name' => 'fontIcons', 'path' => '/assets/css/font-icons.css', ), array( 'name' => 'animate', 'path' => '/assets/css/animate.css', ), array( 'name' => 'responsive', 'path' => '/assets/css/responsive.css', ), ), 'js' => array( array( 'name' => 'jquery', 'path' => '', 'jquery' => 'y', ), array( 'name' => 'swiper', 'path' => '/assets/js/swiper.js', ), array( 'name' => 'carousel', 'path' => '/assets/js/owl.carousel.js', ), array( 'name' => 'superfish', 'path' => '/assets/js/superfish.js', ), array( 'name' => 'jRespond', 'path' => '/assets/js/jRespond.js', ), array( 'name' => 'cookie', 'path' => '/assets/js/js.cookie.js', ), array( 'name' => 'appear', 'path' => '/assets/js/jquery.appear.js', ), array( 'name' => 'plugin', 'path' => '/assets/js/jquery.plugin.js', ), array( 'name' => 'countTo', 'path' => '/assets/js/jquery.countTo.js', ), array( 'name' => 'animsition', 'path' => '/assets/js/animsition.js', ), array( 'name' => 'flexslider', 'path' => '/assets/js/jquery.flexslider.js', ), array( 'name' => 'jquery-ui', 'path' => '/assets/js/jquery-ui.js', ), array( 'name' => 'scripts', 'path' => '/assets/js/scripts.js', ), ), ); $spMC->create($args); ?> |