###前提・実現したいこと
エビスコムの「wordpressレッスンブック」で勉強しているものです。
wordpressで<?php comment_form(); ?>を使ってコメントを表示しようとしたのですが、「'format=html5'」を使って表示されるはずの「名前」「メールアドレス」「ウェブサイト」…といった設定が表示されません。
ただし、「title_reply=コメントフォーム」「&label_submit=送信」だけは変更が効いたので「comments.php」が読み込まれていないことはないはずです。
###現在の状況
comments.php
php
1<?php comment_form('format=html5&title_reply=コメントフォーム&label_submit=送信'); ?> 2
読み込んでいるファイルの一覧と、comments.phpの現在のコードです。
現在のサイト表示です。
「コメント」と「名前、メールアドレス、サイト」の表示順が逆になっています。
comments.phpを変更したことによりタイトルと送信ボタンのメッセージがそれぞれ「コメントを残す」「コメントを送信」から変わっています。
ついでに言うと、「次のhtml タグと属性が使えます〜」の表示がないことが気になりました。
php
1<!DOCTYPE html> 2<html lang="ja"> 3<head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <meta http-equiv="X-UA-Compatible" content="ie=edge"> 7 <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); echo '?' . filemtime( get_stylesheet_directory() . '/style.css'); ?>" type="text/css" /> 8 <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous"> 9 <title> 10 <?php bloginfo('name') ?> 11 <?php wp_title('|',true,'right'); ?> 12 </title> 13</head> 14<body<?php body_class(); ?>> 15 16 <?php wp_head(); ?> 17 <header> 18 <div class="container"> 19 <div class="siteinfo"> 20 <h1><a href="<?php echo home_url(); ?>"><?php bloginfo('name') ?></a></h1> 21 <p><?php bloginfo('description'); ?></p> 22 </div> 23 </div> 24 </header> 25 26 27<div class="container"> 28 29 <?php if( is_category() ): ?> 30 <h1 class="archive-title"> 31 <i class="fas fa-folder-open"></i> 32 「<?php single_cat_title(); ?>」に関する記事 33 </h1> 34 <?php endif; ?> 35 36 <?php if( is_month() ): ?> 37 <h1 class="archive-title"> 38 <i class="far fa-clock"></i> 39 「<?php echo get_the_date( 'Y年n月' ); ?>」に投稿した記事 40 </h1> 41 <?php endif; ?> 42 43 <?php if(have_posts()): while (have_posts()): the_post(); ?> 44 45 <article <?php post_class(); ?>> 46 47 <?php if(is_single()): ?> 48 <h1><?php the_title(); ?></h1> 49 <?php else: ?> 50 <h1> <a href="<?php the_permalink();?>"> <?php the_title(); ?></a></h1> 51 <?php endif; ?> 52 53 <div class="postinfo"> 54 <time datetime="<?php echo get_the_date('Y-m-d') ?>"> 55 <i class="far fa-calendar-alt"></i> 56 <?php echo get_the_date(); ?> 57 <i class="far fa-clock"></i> 58 <?php echo get_the_time(); ?> 59 </time> 60 61 <span class="postcat"> 62 <i class="fas fa-folder-open"></i> 63 <?php the_category(','); ?> 64 </span> 65 </div> 66 67 <?php the_content(); ?> 68 69 70 71 72 <?php if(is_single()): ?> 73 <div class="pagenav"> 74 <span class="old"> 75 <?php previous_post_link('%link','<i class="fas fa-chevron-circle-left"></i> %title'); ?> 76 </span> 77 <span class="new"> 78 <?php next_post_link('%link','%title <i class="fas fa-chevron-circle-right"></i>'); ?> 79 </span> 80 </div> 81 <?php endif; ?> 82 83 <?php comments_template(); ?> 84 85 </article> 86 87 <?php endwhile; endif; ?> 88 89 <?php if($wp_query->max_num_pages > 1) ?> 90 <div class="pagenav"> 91 <span class="old"> 92 <?php next_posts_link('<i class="fas fa-chevron-circle-left"></i> 古い記事'); ?> 93 </span> 94 <span class="new"> 95 <?php previous_posts_link('新しい記事 <i class="fas fa-chevron-circle-right"></i>'); ?> 96 </span> 97 </div> 98 99 <div class="blogmenu"> 100 <ul> 101 <?php dynamic_sidebar('sidebar1'); ?> 102 103 <div class="widget"> 104 <ul> 105 <li> 106 <a href="<?php bloginfo('rss2_url'); ?>"><i class="fas fa-rss-square"></i> RSS</a> 107 </li> 108 </ul> 109 </div> 110 111 </ul> 112 113 </div> 114</div><!-- container --> 115 116 117 <footer> 118 <div class="container"> 119 <small>Copyright © <?php bloginfo('name'); ?></small> 120 </div> 121 </footer> 122 <?php wp_footer(); ?> 123 124</body> 125</html>
index.phpのコードです。<?php comments_template(); ?>を筆記しています。
#補足情報(FW/ツールのバージョンなど)
ブラウザ:chrome(最新のバージョン)
wordpressバージョン:WordPress 4.9.9
テキストエディタ:atom(ver:1.32.2)
サーバー:スターサーバーフリー
ftp:filizilla
回答1件
あなたの回答
tips
プレビュー