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

質問編集履歴

4

使用ツールを追記

2020/12/08 01:10

投稿

Tomokui
Tomokui

スコア23

title CHANGED
File without changes
body CHANGED
@@ -30,8 +30,10 @@
30
30
  https://www.tsukimi.net/wordpress_thumbnail.html
31
31
 
32
32
  ### 補足情報(FW/ツールのバージョンなど)
33
+ ez-HTML 7.71
34
+ Dream weaver CS5
35
+ 上記2つは使える環境です!
33
36
 
34
- ここにより詳細な情報を記載してください。
35
37
  ### 前提・実現したいこと
36
38
 
37
39
  ここに質問の内容を詳しく書いてください。

3

初心者アイコンをオンにしました!あとエラーが出ているとかって表記が残ったままになっていたので削除してます。

2020/12/08 01:10

投稿

Tomokui
Tomokui

スコア23

title CHANGED
File without changes
body CHANGED
@@ -55,7 +55,7 @@
55
55
  http://ictaga.com/members/okui/wp2/
56
56
  ```
57
57
 
58
- ### 該当のソースコード
58
+ ### 該当のソースコード 
59
59
 
60
60
  ```php
61
61
  <?php

2

コードを最新盤に差し替えました!

2020/12/01 04:21

投稿

Tomokui
Tomokui

スコア23

title CHANGED
File without changes
body CHANGED
@@ -51,8 +51,7 @@
51
51
  http://www.sakata-kensetu.co.jp/contents/?cat=3
52
52
 
53
53
  ```
54
- 96行目にエラー表示されるようになってます!
54
+ ▼サイトの現状
55
-  ↓
56
55
  http://ictaga.com/members/okui/wp2/
57
56
  ```
58
57
 
@@ -90,70 +89,74 @@
90
89
  </ul>
91
90
  <!-- カテゴリ一覧の表示 ここまで -->
92
91
 
93
- <!-- アイキャッチ画像一覧の表示 ここから -->
92
+ <!-- アイキャッチ画像一覧の表示 ここから -->
94
93
  <div class="article-wrap">
95
- <?php
94
+ <?php
96
95
 
97
- $archive_title = '';
96
+ $archive_title = '';
98
- $archive_subtitle = '';
97
+ $archive_subtitle = '';
99
98
 
100
- if ( is_search() ) {
99
+ if ( is_search() ) {
101
- global $wp_query;
100
+ global $wp_query;
102
101
 
103
- $archive_title = sprintf(
102
+ $archive_title = sprintf(
104
- '%1$s %2$s',
103
+ '%1$s %2$s',
105
- '<span class="color-accent">' . __( 'Search:', 'twentytwenty' ) . '</span>',
104
+ '<span class="color-accent">' . __( 'Search:', 'twentytwenty' ) . '</span>',
106
- '&ldquo;' . get_search_query() . '&rdquo;'
105
+ '&ldquo;' . get_search_query() . '&rdquo;'
107
- );
106
+ );
108
107
 
109
- if ( $wp_query->found_posts ) {
108
+ if ( $wp_query->found_posts ) {
110
- $archive_subtitle = sprintf(
109
+ $archive_subtitle = sprintf(
111
- /* translators: %s: Number of search results. */
110
+ /* translators: %s: Number of search results. */
112
- _n(
111
+ _n(
113
- 'We found %s result for your search.',
112
+ 'We found %s result for your search.',
114
- 'We found %s results for your search.',
113
+ 'We found %s results for your search.',
115
- $wp_query->found_posts,
114
+ $wp_query->found_posts,
116
- 'twentytwenty'
115
+ 'twentytwenty'
117
- ),
116
+ ),
118
- number_format_i18n( $wp_query->found_posts )
117
+ number_format_i18n( $wp_query->found_posts )
119
- );
118
+ );
120
- } else {
119
+ } else {
121
- $archive_subtitle = __( 'We could not find any results for your search. You can give it another try through the search form below.', 'twentytwenty' );
120
+ $archive_subtitle = __( 'We could not find any results for your search. You can give it another try through the search form below.', 'twentytwenty' );
122
- }
121
+ }
123
- } elseif ( is_archive() && ! have_posts() ) {
122
+ } elseif ( is_archive() && ! have_posts() ) {
124
- $archive_title = __( 'Nothing Found', 'twentytwenty' );
123
+ $archive_title = __( 'Nothing Found', 'twentytwenty' );
125
- } elseif ( ! is_home() ) {
124
+ } elseif ( ! is_home() ) {
126
- $archive_title = get_the_archive_title();
125
+ $archive_title = get_the_archive_title();
127
- $archive_subtitle = get_the_archive_description();
126
+ $archive_subtitle = get_the_archive_description();
128
- }
127
+ }
129
128
 
130
- if ( $archive_title || $archive_subtitle ) {
129
+ if ( $archive_title || $archive_subtitle ) {
131
- ?>
130
+ ?>
132
131
 
133
- <header class="archive-header has-text-align-center header-footer-group">
132
+ <header class="archive-header has-text-align-center header-footer-group">
134
133
 
135
- <div class="archive-header-inner section-inner medium">
134
+ <div class="archive-header-inner section-inner medium">
136
135
 
137
- <?php if ( $archive_title ) { ?>
136
+ <?php if ( $archive_title ) { ?>
138
- <h3 class="archive-title"><?php echo wp_kses_post( $archive_title ); ?></h3>
137
+ <h3 class="archive-title"><?php echo wp_kses_post( $archive_title ); ?></h3>
139
- <?php } ?>
138
+ <?php } ?>
140
- <?php
139
+ <?php
141
- $thumbnail_id = get_post_thumbnail_id();//アイキャッチのID
140
+ $thumbnail_id = get_post_thumbnail_id();//アイキャッチのID
142
- $data = wp_get_attachment_image_src($thumbnail_id,'thumbnail');//配列
141
+ $data = wp_get_attachment_image_src($thumbnail_id,'thumbnail');//配列
143
- ?>
142
+ ?>
144
- <img src="<?php echo $data[0] ;?>" width="<?php echo $data[1] ;?>" height="<?php echo $data[2] ;?>" >
143
+ <img src="<?php echo $data[0] ;?>" width="<?php echo $data[1] ;?>" height="<?php echo $data[2] ;?>" >
145
- <?php if ( $archive_subtitle ) { ?>
144
+ <?php if ( $archive_subtitle ) { ?>
146
- <div class="archive-subtitle section-inner thin max-percentage intro-text"><?php echo wp_kses_post( wpautop( $archive_subtitle ) ); ?></div>
145
+ <div class="archive-subtitle section-inner thin max-percentage intro-text"><?php echo wp_kses_post( wpautop( $archive_subtitle ) ); ?></div>
147
- <?php } ?>
146
+ <?php } ?>
148
147
 
149
- </div><!-- .archive-header-inner -->
148
+ </div><!-- .archive-header-inner -->
150
149
 
151
- </header><!-- .archive-header -->
150
+ </header><!-- .archive-header -->
152
151
 
153
- <?php
152
+ <?php
154
- }
153
+ }
155
154
 
155
+ if ( have_posts() ) {
156
+
157
+ $i = 0;
158
+
156
-  while ( have_posts() ) {
159
+ while ( have_posts() ) {
157
160
  $i++;
158
161
  if ( $i > 1 ) {
159
162
  echo '<hr class="post-separator styled-separator is-style-wide section-inner" aria-hidden="true" />';
@@ -163,28 +166,27 @@
163
166
 
164
167
  get_template_part( 'template-parts/content', get_post_type() );
165
168
 
166
-  }
169
+ }
167
-   }
168
- } elseif ( is_search() ) {
170
+ } elseif ( is_search() ) {
169
- ?>
171
+ ?>
170
172
 
171
- <div class="no-search-results-form section-inner thin">
173
+ <div class="no-search-results-form section-inner thin">
172
174
 
173
- <?php
175
+ <?php
174
- get_search_form(
176
+ get_search_form(
175
- array(
177
+ array(
176
- 'label' => __( 'search again', 'twentytwenty' ),
178
+ 'label' => __( 'search again', 'twentytwenty' ),
177
- )
179
+ )
178
- );
180
+ );
179
- ?>
181
+ ?>
180
182
 
181
- </div><!-- .no-search-results -->
183
+ </div><!-- .no-search-results -->
182
184
 
183
- <?php
185
+ <?php
184
- }
186
+ }
185
- ?>
187
+ ?>
186
188
 
187
- <?php get_template_part( 'template-parts/pagination' ); ?>
189
+ <?php get_template_part( 'template-parts/pagination' ); ?>
188
190
 
189
191
  </main><!-- #site-content -->
190
192
  </div><!-- /.article-wrap -->

1

コードの最新状態への差し替え

2020/12/01 04:17

投稿

Tomokui
Tomokui

スコア23

title CHANGED
File without changes
body CHANGED
@@ -51,31 +51,69 @@
51
51
  http://www.sakata-kensetu.co.jp/contents/?cat=3
52
52
 
53
53
  ```
54
- エラーといエラーは出ていですが、カスタマイズの最中って感じです!
54
+ 96行目にエラー表示されるよなってす!
55
+  ↓
56
+ http://ictaga.com/members/okui/wp2/
55
57
  ```
56
58
 
57
59
  ### 該当のソースコード
58
60
 
61
+ ```php
59
62
  <?php
63
+ /**
60
- $archive_title = '';
64
+ * The main template file
65
+ *
66
+ * This is the most generic template file in a WordPress theme
67
+ * and one of the two required files for a theme (the other being style.css).
68
+ * It is used to display a page when nothing more specific matches a query.
69
+ * E.g., it puts together the home page when no home.php file exists.
70
+ *
71
+ * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
72
+ *
73
+ * @package WordPress
61
- $archive_subtitle = '';
74
+ * @subpackage Twenty_Twenty
75
+ * @since Twenty Twenty 1.0
76
+ */
62
77
 
78
+ get_header();
79
+ ?>
80
+
81
+ <main id="site-content" role="main">
82
+ <!-- カテゴリ一覧の表示 ここから -->
83
+ <ul class="category_list">
84
+ <?php
85
+ $cat_all = get_terms( "category", "fields=all&get=all&exclude_tree=12&exclude=11" );
86
+ foreach($cat_all as $value):
87
+ ?>
88
+ <li><a href="<?php echo get_category_link($value->term_id); ?>"><?php echo $value->name;?>(<?php echo $value->count;?>)</a></li>
89
+ <?php endforeach; ?>
90
+ </ul>
91
+ <!-- カテゴリ一覧の表示 ここまで -->
92
+
93
+ <!-- アイキャッチ画像一覧の表示 ここから -->
94
+ <div class="article-wrap">
95
+ <?php
96
+
97
+ $archive_title = '';
98
+ $archive_subtitle = '';
99
+
63
- if ( is_search() ) {
100
+ if ( is_search() ) {
64
- global $wp_query;
101
+ global $wp_query;
102
+
65
103
  $archive_title = sprintf(
66
- '%1$s %2$s',
104
+ '%1$s %2$s',
67
- '<span class="color-accent">' . __( 'Search:', 'twentytwenty' ) . '</span>',
105
+ '<span class="color-accent">' . __( 'Search:', 'twentytwenty' ) . '</span>',
68
- '&ldquo;' . get_search_query() . '&rdquo;'
106
+ '&ldquo;' . get_search_query() . '&rdquo;'
69
- );
107
+ );
70
108
 
71
- if ( $wp_query->found_posts ) {
109
+ if ( $wp_query->found_posts ) {
72
- $archive_subtitle = sprintf(
110
+ $archive_subtitle = sprintf(
73
- /* translators: %s: Number of search results. */
111
+ /* translators: %s: Number of search results. */
74
- _n(
112
+ _n(
75
- 'We found %s result for your search.',
113
+ 'We found %s result for your search.',
76
- 'We found %s results for your search.',
114
+ 'We found %s results for your search.',
77
- $wp_query->found_posts,
115
+ $wp_query->found_posts,
78
- 'twentytwenty'
116
+ 'twentytwenty'
79
117
  ),
80
118
  number_format_i18n( $wp_query->found_posts )
81
119
  );
@@ -99,6 +137,11 @@
99
137
  <?php if ( $archive_title ) { ?>
100
138
  <h3 class="archive-title"><?php echo wp_kses_post( $archive_title ); ?></h3>
101
139
  <?php } ?>
140
+ <?php
141
+ $thumbnail_id = get_post_thumbnail_id();//アイキャッチのID
142
+ $data = wp_get_attachment_image_src($thumbnail_id,'thumbnail');//配列
143
+ ?>
144
+ <img src="<?php echo $data[0] ;?>" width="<?php echo $data[1] ;?>" height="<?php echo $data[2] ;?>" >
102
145
  <?php if ( $archive_subtitle ) { ?>
103
146
  <div class="archive-subtitle section-inner thin max-percentage intro-text"><?php echo wp_kses_post( wpautop( $archive_subtitle ) ); ?></div>
104
147
  <?php } ?>
@@ -110,20 +153,18 @@
110
153
  <?php
111
154
  }
112
155
 
113
- if ( have_posts() ) {
156
+  while ( have_posts() ) {
157
+ $i++;
158
+ if ( $i > 1 ) {
159
+ echo '<hr class="post-separator styled-separator is-style-wide section-inner" aria-hidden="true" />';
160
+ }
114
161
 
115
- $i = 0;
162
+ the_post();
116
163
 
117
- while ( have_posts() ) {
118
- $i++;
119
- if ( $i > 1 ) {
120
- echo '<hr class="post-separator styled-separator is-style-wide section-inner" aria-hidden="true" />';
164
+ get_template_part( 'template-parts/content', get_post_type() );
121
- }
122
- the_post();
123
165
 
124
- get_template_part( 'template-parts/content', get_post_type() );
125
-
126
- }
166
+  }
167
+   }
127
168
  } elseif ( is_search() ) {
128
169
  ?>
129
170
 
@@ -146,13 +187,14 @@
146
187
  <?php get_template_part( 'template-parts/pagination' ); ?>
147
188
 
148
189
  </main><!-- #site-content -->
190
+ </div><!-- /.article-wrap -->
149
191
 
150
192
  <?php get_template_part( 'template-parts/footer-menus-widgets' ); ?>
151
193
 
152
194
  <?php
153
195
  get_footer();
196
+ ```
154
197
 
155
-
156
198
  ```ここに言語名を入力
157
199
  PHP
158
200
  ```