Q&A
前提
初めてhtmlファイルからwordpressでカスタムテーマを作ろうとしています。
こちらの動画を見ています。
https://www.youtube.com/watch?v=-h7gOJbIpmo&t=695s&ab_channel=freeCodeCamp.org
17:00辺りで「there is a new theme here」とstyle.cssが反映されているのですが、私の場合なりません。。。
動画の概要欄のリンクにあったコードをインストールしてから動画を見ながらファイルやフォルダーをつくって来ました。
https://github.com/wilsmex/blog-site-template
動画だと最初からtheme-templateがあるのでそれが私のblog-site-template-masterに当たるのだと思います。
少し問題が変わりました
画像のようにfunctions.phpにエラーがあると表示されるようになりました。
functions.php
1 2<!-- 22:00 --> 3 4<?php 5 6 7function followyoriss_resister_styles() { 8 9 wp_enqueue_style('followyoriss-bootstrap', get_template_directory_uri( ) , "/style.css", array(), '1.0', 'all') 10 11 12このラインが赤線でvscodeでもエラーになります。} 13 14add_action( 'wp_enqueue_scripts', 'followyoriss_resister_styles'); 15 16 17// css js 読み込み 18 19function enqueue_my_scripts() { 20 wp_enqueue_style( 'my-stylesheet', get_stylesheet_uri() ); 21 wp_enqueue_script( 'jquery' ); 22} 23 24add_action( 'wp_enqueue_scripts', 'enqueue_my_scripts'); 25 26?> 27
実現したいこと
「壊れているテーマ followyoriss スタイルシートが見つかりません。」とあるのでstyle.cssを正常に動作させたいです。
動画の34:00のスクショです。
発生している問題・エラーメッセージ
Wordpressの外観>テーマを開くと一枚目の画像のようになり、それをクリックすると2枚目のようになります。
該当のソースコード
太字で表示されているコードを見たら黄色いハイライトのところだとわかりました。このコードはConoha WINGのファイルマネージャーからコピペしたものです。
blogsitetemplatemaster/css/style.css
1:root { 2 --blue: #007bff; 3 --indigo: #6610f2; 4 --purple: #6f42c1; 5 --pink: #ee3577; 6 --red: #dc3545; 7 --orange: #f68e62; 8 --yellow: #ffc107; 9 --green: #28a745; 10 --teal: #20c997; 11 --cyan: #17a2b8; 12 --white: #fff; 13 --gray: #767575; 14 --gray-dark: #434242; 15 --primary: #6f42c1; 16 --secondary: #4f4f4f; 17 --success: #28a745; 18 --info: #17a2b8; 19 --warning: #ffc107; 20 --danger: #dc3545; 21 --light: #c2c2c2; 22 --lightgray: #eeeeee; 23 --dark: #434242; 24 --breakpoint-xs: 0; 25 --breakpoint-sm: 576px; 26 --breakpoint-md: 768px; 27 --breakpoint-lg: 992px; 28 --breakpoint-xl: 1200px; 29 --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 30 --font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 31 /* Font Sizes */ 32 --font-normal: 1em; 33 --font-small: 0.8125rem; 34 /* Sidebar */ 35 --sidebar-width: 280px; 36 --content-max-width: 860px; 37} 38 39*, 40*::before, 41*::after { 42 box-sizing: border-box 43} 44 45html { 46 line-height: 1.15; 47} 48body { 49 color: var(--secondary); 50 overflow-x: hidden 51} 52a{ 53 color: var(--pink); 54} 55h1, 56h2, 57h3, 58h4, 59 60文字数制限なので割愛
style.css
1/* 2Theme Name: Follow Yoriss67 3Text Domain: Follow Yoriss67 4Version: 1.0 5Description: Fancy left sidebar theme 6Tags: left-sidebar, responsive, fancy 7Author: Iori 8Author URI: https://www.yorissbloggk.com/ 9*/
試したこと
「Expected single stylesheet key」とあるのでblog-site-template-masterのstyle.cssの内容をルートディレクトリのstyle.cssにペーストし、上の2つのコードを同じファイルにまとめましたが変わりませんでした。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。