質問編集履歴
4
使用ツールを追記
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
初心者アイコンをオンにしました!あとエラーが出ているとかって表記が残ったままになっていたので削除してます。
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
コードを最新盤に差し替えました!
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
|
-
|
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
|
-
|
94
|
+
<?php
|
96
95
|
|
97
|
-
|
96
|
+
$archive_title = '';
|
98
|
-
|
97
|
+
$archive_subtitle = '';
|
99
98
|
|
100
|
-
|
99
|
+
if ( is_search() ) {
|
101
|
-
|
100
|
+
global $wp_query;
|
102
101
|
|
103
|
-
|
102
|
+
$archive_title = sprintf(
|
104
|
-
|
103
|
+
'%1$s %2$s',
|
105
|
-
|
104
|
+
'<span class="color-accent">' . __( 'Search:', 'twentytwenty' ) . '</span>',
|
106
|
-
|
105
|
+
'“' . get_search_query() . '”'
|
107
|
-
|
106
|
+
);
|
108
107
|
|
109
|
-
|
108
|
+
if ( $wp_query->found_posts ) {
|
110
|
-
|
109
|
+
$archive_subtitle = sprintf(
|
111
|
-
|
110
|
+
/* translators: %s: Number of search results. */
|
112
|
-
|
111
|
+
_n(
|
113
|
-
|
112
|
+
'We found %s result for your search.',
|
114
|
-
|
113
|
+
'We found %s results for your search.',
|
115
|
-
|
114
|
+
$wp_query->found_posts,
|
116
|
-
|
115
|
+
'twentytwenty'
|
117
|
-
|
116
|
+
),
|
118
|
-
|
117
|
+
number_format_i18n( $wp_query->found_posts )
|
119
|
-
|
118
|
+
);
|
120
|
-
|
119
|
+
} else {
|
121
|
-
|
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
|
-
|
122
|
+
} elseif ( is_archive() && ! have_posts() ) {
|
124
|
-
|
123
|
+
$archive_title = __( 'Nothing Found', 'twentytwenty' );
|
125
|
-
|
124
|
+
} elseif ( ! is_home() ) {
|
126
|
-
|
125
|
+
$archive_title = get_the_archive_title();
|
127
|
-
|
126
|
+
$archive_subtitle = get_the_archive_description();
|
128
|
-
|
127
|
+
}
|
129
128
|
|
130
|
-
|
129
|
+
if ( $archive_title || $archive_subtitle ) {
|
131
|
-
|
130
|
+
?>
|
132
131
|
|
133
|
-
|
132
|
+
<header class="archive-header has-text-align-center header-footer-group">
|
134
133
|
|
135
|
-
|
134
|
+
<div class="archive-header-inner section-inner medium">
|
136
135
|
|
137
|
-
|
136
|
+
<?php if ( $archive_title ) { ?>
|
138
|
-
|
137
|
+
<h3 class="archive-title"><?php echo wp_kses_post( $archive_title ); ?></h3>
|
139
|
-
|
138
|
+
<?php } ?>
|
140
|
-
|
139
|
+
<?php
|
141
|
-
|
140
|
+
$thumbnail_id = get_post_thumbnail_id();//アイキャッチのID
|
142
|
-
|
141
|
+
$data = wp_get_attachment_image_src($thumbnail_id,'thumbnail');//配列
|
143
|
-
|
142
|
+
?>
|
144
|
-
|
143
|
+
<img src="<?php echo $data[0] ;?>" width="<?php echo $data[1] ;?>" height="<?php echo $data[2] ;?>" >
|
145
|
-
|
144
|
+
<?php if ( $archive_subtitle ) { ?>
|
146
|
-
|
145
|
+
<div class="archive-subtitle section-inner thin max-percentage intro-text"><?php echo wp_kses_post( wpautop( $archive_subtitle ) ); ?></div>
|
147
|
-
|
146
|
+
<?php } ?>
|
148
147
|
|
149
|
-
|
148
|
+
</div><!-- .archive-header-inner -->
|
150
149
|
|
151
|
-
|
150
|
+
</header><!-- .archive-header -->
|
152
151
|
|
153
|
-
|
152
|
+
<?php
|
154
|
-
|
153
|
+
}
|
155
154
|
|
155
|
+
if ( have_posts() ) {
|
156
|
+
|
157
|
+
$i = 0;
|
158
|
+
|
156
|
-
|
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
|
-
|
170
|
+
} elseif ( is_search() ) {
|
169
|
-
|
171
|
+
?>
|
170
172
|
|
171
|
-
|
173
|
+
<div class="no-search-results-form section-inner thin">
|
172
174
|
|
173
|
-
|
175
|
+
<?php
|
174
|
-
|
176
|
+
get_search_form(
|
175
|
-
|
177
|
+
array(
|
176
|
-
|
178
|
+
'label' => __( 'search again', 'twentytwenty' ),
|
177
|
-
|
179
|
+
)
|
178
|
-
|
180
|
+
);
|
179
|
-
|
181
|
+
?>
|
180
182
|
|
181
|
-
|
183
|
+
</div><!-- .no-search-results -->
|
182
184
|
|
183
|
-
|
185
|
+
<?php
|
184
|
-
|
186
|
+
}
|
185
|
-
|
187
|
+
?>
|
186
188
|
|
187
|
-
|
189
|
+
<?php get_template_part( 'template-parts/pagination' ); ?>
|
188
190
|
|
189
191
|
</main><!-- #site-content -->
|
190
192
|
</div><!-- /.article-wrap -->
|
1
コードの最新状態への差し替え
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
|
-
|
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
|
-
|
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
|
-
|
101
|
+
global $wp_query;
|
102
|
+
|
65
103
|
$archive_title = sprintf(
|
66
|
-
|
104
|
+
'%1$s %2$s',
|
67
|
-
|
105
|
+
'<span class="color-accent">' . __( 'Search:', 'twentytwenty' ) . '</span>',
|
68
|
-
|
106
|
+
'“' . get_search_query() . '”'
|
69
|
-
|
107
|
+
);
|
70
108
|
|
71
|
-
|
109
|
+
if ( $wp_query->found_posts ) {
|
72
|
-
|
110
|
+
$archive_subtitle = sprintf(
|
73
|
-
|
111
|
+
/* translators: %s: Number of search results. */
|
74
|
-
|
112
|
+
_n(
|
75
|
-
|
113
|
+
'We found %s result for your search.',
|
76
|
-
|
114
|
+
'We found %s results for your search.',
|
77
|
-
|
115
|
+
$wp_query->found_posts,
|
78
|
-
|
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
|
-
|
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
|
-
|
162
|
+
the_post();
|
116
163
|
|
117
|
-
while ( have_posts() ) {
|
118
|
-
$i++;
|
119
|
-
if ( $i > 1 ) {
|
120
|
-
|
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
|
```
|