teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

header.phpのソースを追記します。

2019/08/30 23:53

投稿

shinkus
shinkus

スコア7

title CHANGED
File without changes
body CHANGED
@@ -38,8 +38,8 @@
38
38
  0. 先のテーマ配布者からのソースを消す際、header.phpの36行目の表記がおかしいとWPからメッセージが出てウェブ上での更新ができなかったため、FTP経由でソースを書き換えました。
39
39
  一旦解決したように思えたので、その際のエラーメッセージが不明です。
40
40
 
41
- ### header.php
41
+ ### header.phpのソース
42
- ```
42
+ ```html
43
43
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
44
44
  <html xmlns="http://www.w3.org/1999/xhtml">
45
45
  <head profile="http://gmpg.org/xfn/11">

2

header.phpのソースを追記します。

2019/08/30 23:53

投稿

shinkus
shinkus

スコア7

title CHANGED
File without changes
body CHANGED
@@ -38,147 +38,97 @@
38
38
  0. 先のテーマ配布者からのソースを消す際、header.phpの36行目の表記がおかしいとWPからメッセージが出てウェブ上での更新ができなかったため、FTP経由でソースを書き換えました。
39
39
  一旦解決したように思えたので、その際のエラーメッセージが不明です。
40
40
 
41
- ### function.php
41
+ ### header.php
42
42
  ```
43
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
44
+ <html xmlns="http://www.w3.org/1999/xhtml">
43
- <?php
45
+ <head profile="http://gmpg.org/xfn/11">
46
+ <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
44
47
 
48
+ <title><?php
49
+ global $page, $paged; wp_title( '|', true, 'right' ); bloginfo( 'name' );
50
+ $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) echo " | $site_description";
51
+ if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s', 'neutral' ), max( $paged, $page ) );
52
+ ?></title>
53
+ <meta name="description" content="<?php echo bloginfo('description'); ?>" />
45
54
 
46
- // ����t�@�C���̓ǂݍ���
55
+ <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
56
+ <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
47
- load_textdomain('neutral', dirname(__FILE__).'/languages/' . get_locale() . '.mo');
57
+ <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
48
58
 
59
+ <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" />
60
+ <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/comment-style.css" type="text/css" />
61
+ <?php if (strtoupper(get_locale()) == 'JA'): ?>
62
+ <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/japanese.css" type="text/css" />
63
+ <?php endif; ?>
49
64
 
65
+ <?php wp_enqueue_script( 'jquery' ); ?>
66
+ <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
67
+ <?php wp_head(); ?>
50
68
 
69
+ <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/scroll.js"></script>
70
+ <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jscript.js"></script>
71
+ <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/comment.js"></script>
51
72
 
52
- //���S�摜�p�֐�
73
+ <!--[if IE 7]>
53
- get_template_part('functions/header-logo');
74
+ <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/ie7.js"></script>
75
+ <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/ie7.css" type="text/css" />
76
+ <![endif]-->
54
77
 
78
+ <?php $options = get_neutral_option(); ?>
55
79
 
56
- // �X�^�C���V�[�g�̓ǂݍ���
57
- add_action('admin_print_styles', 'my_admin_CSS');
58
- function my_admin_CSS() {
59
- wp_enqueue_style('myAdminCSS', get_bloginfo('stylesheet_directory').'/admin/my_admin.css');
60
- };
80
+ </head>
81
+ <body class="default<?php if(is_page_template('page-noside.php')||is_page_template('page-noside-nocomment.php')||$options['layout'] == 'noside') { echo ' no_side'; }; if (!$options['show_category'] and !$options['show_tag'] and !$options['show_comment']) { echo ' no_postmeta'; }; if (!$options['show_date'] and !$options['show_author']) { echo ' no_postinfo'; }; ?>">
61
82
 
83
+ <div id="wrapper">
62
84
 
63
- // �y�[�W�i�r�p
64
- function show_posts_nav() {
65
- global $wp_query;
66
- return ($wp_query->max_num_pages > 1);
85
+ <div id="<?php if (has_nav_menu('header-menu')) { echo "header"; } else { echo "header2"; }; ?>">
67
- };
68
86
 
69
-
70
- // �J�X�^�����j���[�̐ݒ�
71
- if(function_exists('register_nav_menu')) {
72
- register_nav_menu( 'header-menu', __( 'Header menu', 'neutral' ) );
73
- }
74
-
75
-
76
-
77
- // Sidebar widget
78
- if ( function_exists('register_sidebar') ) {
79
- register_sidebar(array(
80
- 'before_widget' => '<div class="side_box %2$s" id="%1$s">'."\n",
81
- 'after_widget' => "</div>\n",
82
- 'before_title' => '<h3 class="side_title">',
83
- 'after_title' => "</h3>\n",
84
- 'name' => __('Side top', 'neutral'),
85
- 'id' => 'top'
86
- ));
87
- register_sidebar(array(
88
- 'before_widget' => '<div class="side_box_short %2$s" id="%1$s">'."\n",
89
- 'after_widget' => "</div>\n",
90
- 'before_title' => '<h3 class="side_title">',
91
- 'after_title' => "</h3>\n",
92
- 'name' => __('Side middle left', 'neutral'),
93
- 'id' => 'left'
94
- ));
95
- register_sidebar(array(
96
- 'before_widget' => '<div class="side_box_short %2$s" id="%1$s">'."\n",
97
- 'after_widget' => "</div>\n",
98
- 'before_title' => '<h3 class="side_title">',
99
- 'after_title' => "</h3>\n",
100
- 'name' => __('Side middle right', 'neutral'),
101
- 'id' => 'right'
102
- ));
103
- register_sidebar(array(
104
- 'before_widget' => '<div class="side_box %2$s" id="%1$s">'."\n",
105
- 'after_widget' => "</div>\n",
106
- 'before_title' => '<h3 class="side_title">',
107
- 'after_title' => "</h3>\n",
108
- 'name' => __('Side bottom', 'neutral'),
109
- 'id' => 'bottom'
110
- ));
111
- }
112
-
113
- // Original custom comments function is written by mg12 - http://www.neoease.com/
114
-
115
- if (function_exists('wp_list_comments')) {
116
- // comment count
117
- add_filter('get_comments_number', 'comment_count', 0);
118
- function comment_count( $commentcount ) {
119
- global $id;
120
- $_commnets = get_comments('post_id=' . $id);
121
- $comments_by_type = &separate_comments($_commnets);
122
- return count($comments_by_type['comment']);
123
- }
124
- }
125
-
126
-
127
- function custom_comments($comment, $args, $depth) {
128
- $GLOBALS['comment'] = $comment;
129
- global $commentcount;
87
+ <!-- logo -->
130
- if(!$commentcount) {
131
- $commentcount = 0;
132
- }
133
- ?>
134
-
135
- <li class="comment <?php if($comment->comment_author_email == get_the_author_meta('email')) {echo 'admin-comment';} else {echo 'guest-comment';} ?>" id="comment-<?php comment_ID() ?>">
136
- <div class="comment-meta">
88
+ <div id="logo">
137
- <div class="comment-meta-left">
89
+ <?php the_dp_logo(); ?>
138
- <?php if (function_exists('get_avatar') && get_option('show_avatars')) { echo get_avatar($comment, 35); } ?>
90
+ </div>
139
91
 
140
- <ul class="comment-name-date">
141
- <li class="comment-name">
142
- <?php if (get_comment_author_url()) : ?>
143
- <a id="commentauthor-<?php comment_ID() ?>" class="url <?php if($comment->comment_author_email == get_the_author_meta('email')) {echo 'admin-url';} else {echo 'guest-url';} ?>" href="<?php comment_author_url() ?>" rel="external nofollow">
144
- <?php else : ?>
145
- <span id="commentauthor-<?php comment_ID() ?>">
146
- <?php endif; ?>
147
-
148
- <?php comment_author(); ?>
149
-
150
- <?php if(get_comment_author_url()) : ?>
151
- </a>
152
- <?php else : ?>
153
- </span>
154
- <?php endif; $options = get_neutral_option(); ?>
155
- </li>
156
- <li class="comment-date"><?php echo get_comment_time(__('M jS. Y', 'neutral')); if ($options['show_comment_time']) : echo get_comment_time(__(' g:ia', 'neutral')); endif; ?></li>
157
- </ul>
92
+ <div id="header_meta">
93
+ <?php if ($options['show_search']) { ?>
94
+ <div id="header_search_area"<?php if (!$options['show_rss']&&!$options['twitter_url']) : echo ' style="margin-right:0;"'; endif; ?>>
95
+ <?php if ($options['custom_search_id']) : ?>
96
+ <form action="http://www.google.com/cse" method="get" id="searchform">
97
+ <div>
98
+ <input id="search_input" type="text" value="<?php _e('SEARCH','neutral'); ?>" name="q" onfocus="if (this.value == '<?php _e('SEARCH','neutral'); ?>') this.value = '';" onblur="if (this.value == '') this.value = '<?php _e('SEARCH','neutral'); ?>';" />
99
+ </div>
100
+ <div>
101
+ <input type="image" src="<?php bloginfo('template_url'); ?>/img/search_button.gif" name="sa" alt="<?php _e('Search from this blog.','neutral'); ?>" title="<?php _e('Search from this blog.','neutral'); ?>" id="search_button" />
102
+ <input type="hidden" name="cx" value="<?php echo $options['custom_search_id']; ?>" />
103
+ <input type="hidden" name="ie" value="UTF-8" />
104
+ </div>
105
+ </form>
106
+ <?php else: ?>
107
+ <form method="get" id="searchform" action="<?php echo esc_url(home_url('/')); ?>">
108
+ <div><input id="search_input" type="text" value="<?php _e('SEARCH','neutral'); ?>" name="s" onfocus="if (this.value == '<?php _e('SEARCH','neutral'); ?>') this.value = '';" onblur="if (this.value == '') this.value = '<?php _e('SEARCH','neutral'); ?>';" /></div>
109
+ <div><input type="image" src="<?php bloginfo('template_url'); ?>/img/search_button.gif" alt="<?php _e('Search from this blog.','neutral'); ?>" title="<?php _e('Search from this blog.','neutral'); ?>" id="search_button" /></div>
110
+ </form>
111
+ <?php endif; ?>
158
112
  </div>
113
+ <?php }; ?>
114
+ <?php if ($options['show_rss']) : ?>
115
+ <a href="<?php bloginfo('rss2_url'); ?>" class="target_blank" id="header_rss" title="<?php _e('RSS','neutral'); ?>" ><?php _e('RSS','neutral'); ?></a>
116
+ <?php endif; ?>
117
+ <?php if ($options['twitter_url']) : ?>
118
+ <a href="<?php echo $options['twitter_url']; ?>" class="target_blank" id="header_twitter" title="<?php _e('Twitter','neutral'); ?>" ><?php _e('Twitter','neutral'); ?></a>
119
+ <?php endif; ?>
120
+ <?php if ($options['facebook_url']) : ?>
121
+ <a href="<?php echo $options['facebook_url']; ?>" class="target_blank" id="header_facebook" title="<?php _e('Facebook','neutral'); ?>" ><?php _e('Facebook','neutral'); ?></a>
122
+ <?php endif; ?>
123
+ </div><!-- END #header_meta -->
159
124
 
160
- <ul class="comment-act">
161
- <?php if (function_exists('comment_reply_link')) {
162
- if ( get_option('thread_comments') == '1' ) { ?>
163
- <li class="comment-reply"><?php comment_reply_link(array_merge( $args, array('add_below' => 'comment-content', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => '<span><span>'.__('REPLY','neutral').'</span></span>'))) ?></li>
164
- <?php } else { ?>
165
- <li class="comment-reply"><a href="javascript:void(0);" onclick="MGJS_CMT.reply('commentauthor-<?php comment_ID() ?>', 'comment-<?php comment_ID() ?>', 'comment');"><?php _e('REPLY', 'neutral'); ?></a></li>
166
- <?php }
167
- } else { ?>
168
- <li class="comment-reply"><a href="javascript:void(0);" onclick="MGJS_CMT.reply('commentauthor-<?php comment_ID() ?>', 'comment-<?php comment_ID() ?>', 'comment');"><?php _e('REPLY', 'neutral'); ?></a></li>
169
- <?php } ?>
170
- <li class="comment-quote"><a href="javascript:void(0);" onclick="MGJS_CMT.quote('commentauthor-<?php comment_ID() ?>', 'comment-<?php comment_ID() ?>', 'comment-content-<?php comment_ID() ?>', 'comment');"><?php _e('QUOTE', 'neutral'); ?></a></li>
171
- <?php edit_comment_link(__('EDIT', 'neutral'), '<li class="comment-edit">', '</li>'); ?>
172
- </ul>
173
-
125
+ <?php if (has_nav_menu('header-menu')) { ?>
126
+ <div class="header_menu">
127
+ <?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'theme_location' => 'header-menu' , 'container' => '' ) ); ?>
174
128
  </div>
175
- <div class="comment-content" id="comment-content-<?php comment_ID() ?>">
129
+ <?php } else { ?>
176
- <?php if ($comment->comment_approved == '0') : ?>
130
+ <div class="no_header_menu"></div>
177
- <span class="comment-note"><?php _e('Your comment is awaiting moderation.', 'neutral'); ?></span>
178
- <?php endif; ?>
131
+ <?php }; ?>
179
- <?php comment_text(); ?>
180
- </div>
181
132
 
182
- <?php } ?>
133
+ </div><!-- END #header -->
183
-
184
134
  ```

1

function.phpのソースを添付します。

2019/08/30 23:51

投稿

shinkus
shinkus

スコア7

title CHANGED
File without changes
body CHANGED
@@ -36,4 +36,149 @@
36
36
  0. 同じテンプレートを使っているブログのソースを確認したが、同じ記述でした。
37
37
  0. 念のためそれをコピーして反映させましたが、ダメでした。
38
38
  0. 先のテーマ配布者からのソースを消す際、header.phpの36行目の表記がおかしいとWPからメッセージが出てウェブ上での更新ができなかったため、FTP経由でソースを書き換えました。
39
- 一旦解決したように思えたので、その際のエラーメッセージが不明です。
39
+ 一旦解決したように思えたので、その際のエラーメッセージが不明です。
40
+
41
+ ### function.php
42
+ ```
43
+ <?php
44
+
45
+
46
+ // ����t�@�C���̓ǂݍ���
47
+ load_textdomain('neutral', dirname(__FILE__).'/languages/' . get_locale() . '.mo');
48
+
49
+
50
+
51
+
52
+ //���S�摜�p�֐�
53
+ get_template_part('functions/header-logo');
54
+
55
+
56
+ // �X�^�C���V�[�g�̓ǂݍ���
57
+ add_action('admin_print_styles', 'my_admin_CSS');
58
+ function my_admin_CSS() {
59
+ wp_enqueue_style('myAdminCSS', get_bloginfo('stylesheet_directory').'/admin/my_admin.css');
60
+ };
61
+
62
+
63
+ // �y�[�W�i�r�p
64
+ function show_posts_nav() {
65
+ global $wp_query;
66
+ return ($wp_query->max_num_pages > 1);
67
+ };
68
+
69
+
70
+ // �J�X�^�����j���[�̐ݒ�
71
+ if(function_exists('register_nav_menu')) {
72
+ register_nav_menu( 'header-menu', __( 'Header menu', 'neutral' ) );
73
+ }
74
+
75
+
76
+
77
+ // Sidebar widget
78
+ if ( function_exists('register_sidebar') ) {
79
+ register_sidebar(array(
80
+ 'before_widget' => '<div class="side_box %2$s" id="%1$s">'."\n",
81
+ 'after_widget' => "</div>\n",
82
+ 'before_title' => '<h3 class="side_title">',
83
+ 'after_title' => "</h3>\n",
84
+ 'name' => __('Side top', 'neutral'),
85
+ 'id' => 'top'
86
+ ));
87
+ register_sidebar(array(
88
+ 'before_widget' => '<div class="side_box_short %2$s" id="%1$s">'."\n",
89
+ 'after_widget' => "</div>\n",
90
+ 'before_title' => '<h3 class="side_title">',
91
+ 'after_title' => "</h3>\n",
92
+ 'name' => __('Side middle left', 'neutral'),
93
+ 'id' => 'left'
94
+ ));
95
+ register_sidebar(array(
96
+ 'before_widget' => '<div class="side_box_short %2$s" id="%1$s">'."\n",
97
+ 'after_widget' => "</div>\n",
98
+ 'before_title' => '<h3 class="side_title">',
99
+ 'after_title' => "</h3>\n",
100
+ 'name' => __('Side middle right', 'neutral'),
101
+ 'id' => 'right'
102
+ ));
103
+ register_sidebar(array(
104
+ 'before_widget' => '<div class="side_box %2$s" id="%1$s">'."\n",
105
+ 'after_widget' => "</div>\n",
106
+ 'before_title' => '<h3 class="side_title">',
107
+ 'after_title' => "</h3>\n",
108
+ 'name' => __('Side bottom', 'neutral'),
109
+ 'id' => 'bottom'
110
+ ));
111
+ }
112
+
113
+ // Original custom comments function is written by mg12 - http://www.neoease.com/
114
+
115
+ if (function_exists('wp_list_comments')) {
116
+ // comment count
117
+ add_filter('get_comments_number', 'comment_count', 0);
118
+ function comment_count( $commentcount ) {
119
+ global $id;
120
+ $_commnets = get_comments('post_id=' . $id);
121
+ $comments_by_type = &separate_comments($_commnets);
122
+ return count($comments_by_type['comment']);
123
+ }
124
+ }
125
+
126
+
127
+ function custom_comments($comment, $args, $depth) {
128
+ $GLOBALS['comment'] = $comment;
129
+ global $commentcount;
130
+ if(!$commentcount) {
131
+ $commentcount = 0;
132
+ }
133
+ ?>
134
+
135
+ <li class="comment <?php if($comment->comment_author_email == get_the_author_meta('email')) {echo 'admin-comment';} else {echo 'guest-comment';} ?>" id="comment-<?php comment_ID() ?>">
136
+ <div class="comment-meta">
137
+ <div class="comment-meta-left">
138
+ <?php if (function_exists('get_avatar') && get_option('show_avatars')) { echo get_avatar($comment, 35); } ?>
139
+
140
+ <ul class="comment-name-date">
141
+ <li class="comment-name">
142
+ <?php if (get_comment_author_url()) : ?>
143
+ <a id="commentauthor-<?php comment_ID() ?>" class="url <?php if($comment->comment_author_email == get_the_author_meta('email')) {echo 'admin-url';} else {echo 'guest-url';} ?>" href="<?php comment_author_url() ?>" rel="external nofollow">
144
+ <?php else : ?>
145
+ <span id="commentauthor-<?php comment_ID() ?>">
146
+ <?php endif; ?>
147
+
148
+ <?php comment_author(); ?>
149
+
150
+ <?php if(get_comment_author_url()) : ?>
151
+ </a>
152
+ <?php else : ?>
153
+ </span>
154
+ <?php endif; $options = get_neutral_option(); ?>
155
+ </li>
156
+ <li class="comment-date"><?php echo get_comment_time(__('M jS. Y', 'neutral')); if ($options['show_comment_time']) : echo get_comment_time(__(' g:ia', 'neutral')); endif; ?></li>
157
+ </ul>
158
+ </div>
159
+
160
+ <ul class="comment-act">
161
+ <?php if (function_exists('comment_reply_link')) {
162
+ if ( get_option('thread_comments') == '1' ) { ?>
163
+ <li class="comment-reply"><?php comment_reply_link(array_merge( $args, array('add_below' => 'comment-content', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => '<span><span>'.__('REPLY','neutral').'</span></span>'))) ?></li>
164
+ <?php } else { ?>
165
+ <li class="comment-reply"><a href="javascript:void(0);" onclick="MGJS_CMT.reply('commentauthor-<?php comment_ID() ?>', 'comment-<?php comment_ID() ?>', 'comment');"><?php _e('REPLY', 'neutral'); ?></a></li>
166
+ <?php }
167
+ } else { ?>
168
+ <li class="comment-reply"><a href="javascript:void(0);" onclick="MGJS_CMT.reply('commentauthor-<?php comment_ID() ?>', 'comment-<?php comment_ID() ?>', 'comment');"><?php _e('REPLY', 'neutral'); ?></a></li>
169
+ <?php } ?>
170
+ <li class="comment-quote"><a href="javascript:void(0);" onclick="MGJS_CMT.quote('commentauthor-<?php comment_ID() ?>', 'comment-<?php comment_ID() ?>', 'comment-content-<?php comment_ID() ?>', 'comment');"><?php _e('QUOTE', 'neutral'); ?></a></li>
171
+ <?php edit_comment_link(__('EDIT', 'neutral'), '<li class="comment-edit">', '</li>'); ?>
172
+ </ul>
173
+
174
+ </div>
175
+ <div class="comment-content" id="comment-content-<?php comment_ID() ?>">
176
+ <?php if ($comment->comment_approved == '0') : ?>
177
+ <span class="comment-note"><?php _e('Your comment is awaiting moderation.', 'neutral'); ?></span>
178
+ <?php endif; ?>
179
+ <?php comment_text(); ?>
180
+ </div>
181
+
182
+ <?php } ?>
183
+
184
+ ```