前提・実現したいこと
作成済みのサイトをWordpress化するにあたり、
functions.phpに複数のcss、jsファイルを読み込ませたい。
下記のサイトの手順に従って作業を進めていたが、
全てのCSS、JSファイルが読み込まれていないことに気づいた。
https://haniwaman.com/static-to-wordpress/#CSSJavaScript
発生している問題・エラーメッセージ
最初の1行目のファイル(下記ではbase.css)のみ効いています。
それ以降は機能していません。
Failed to load resource: the server responded with a status of 404 (Not Found) base.css:1 Failed to load resource: the server responded with a status of 404 (Not Found) style.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found) jquery.bxslider.css:1 Failed to load resource: the server responded with a status of 404 (Not Found) lightbox.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found) main.js:1 ・・・
該当のソースコード
php
<?php function my_scripts() { wp_enqueue_style( 'style-name', get_template_directory_uri() . '/css/base.css', array(), '1.0.0', 'all' ); wp_enqueue_style( 'style-name', get_template_directory_uri() . '/css/style.min.css', array(), '1.0.0', 'all' ); wp_enqueue_style( 'style-name', get_template_directory_uri() . '/css/jquery.bxslider.css', array(), '1.0.0', 'all' ); wp_enqueue_style( 'style-name', get_template_directory_uri() . '/css/lightbox.min.css', array(), '1.0.0', 'all' ); wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/main.js', array( 'jquery' ), '1.0.0', true ); wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/smooth-scroll.polyfills.min.js', array( 'jquery' ), '1.0.0', true ); wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/jquery.bxslider.min.js', array( 'jquery' ), '1.0.0', true ); wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/lightbox.min.js', array( 'jquery' ), '1.0.0', true ); } add_action( 'wp_enqueue_scripts', 'my_scripts' ); ?>
まだ回答がついていません
会員登録して回答してみよう