前提・実現したいこと
自作のテーマを作成し、VScodeでテンプレートファイルを編集しながら構築していました。
途中、「MW WP Form」を使ってお問い合わせフォームを作っていたのですが、出来上がったショートコードをエディタ(Gutenberg)に張り付けても、一向に反映されません。
シンプルな文字を入力しても、HTMLで入力しても反映されませんでした。
調べても同じような状況の質問が見当たらず、途方にくれております。
試したこと
テーマを既存の「twenty twenty」に変更したところ、普通に反映されました。
自作テーマにおけるfunctions.phpの記述内容が足りないか、間違っているような気がするので記載しておきます。
<?php /* CSSとJSの読み込み */ function my_scripts() { wp_enqueue_style('style-name', get_template_directory_uri() . '/css/style.css', array(), '1.0.0', 'all'); wp_enqueue_script('script-name', get_template_directory_uri() . '/js/main.js', array('jquery'), '1.0.0', true); } /** * WordPress標準機能 * * @codex https://wpdocs.osdn.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/add_theme_support */ function my_setup() { add_theme_support( 'post-thumbnails' ); add_theme_support( 'automatic-feed-links' ); add_theme_support( 'title-tag' ); add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); } add_action( 'after_setup_theme', 'my_setup' ); /* 投稿の表示件数 */ function news_posts_per_page($query){ if (is_admin() || !$query->is_main_query()) { return; } if ($query->is_front_page()) { $query->set('posts_per_page', '3'); } } add_action('pre_get_posts', 'news_posts_per_page');
style.cssにはテーマネームのみ記載してあります。
@charset "UTF-8"; /* Theme Name: Engress */
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。