質問編集履歴
6
さ
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
'Pagination' コードを設置すると次と前のページでも同じ背景画像の記事一覧しか表示されないです。
|
4
4
|
|
5
5
|
問題点の把握 :
|
6
|
-
1.paginationの問題かも?????
|
6
|
+
1.paginationの問題かも????? 
|
7
7
|
2.ページャーで、繰り返し同じ画像が表示されます。
|
8
8
|
3.それともループされ続けているかも????
|
9
9
|
4.画像がなければノーが画像を表示させたいが、表示されない。
|
5
情報
title
CHANGED
File without changes
|
body
CHANGED
@@ -28,77 +28,7 @@
|
|
28
28
|
このコードの設置場所:blog.php ※single.php ではないです。
|
29
29
|
|
30
30
|
|
31
|
-
<?php if ( $wp_query->max_num_pages > 1 ) : /** ここからページャー */ ?>
|
32
|
-
<div class="navigation">
|
33
|
-
<div class="alignleft"><?php previous_posts_link( '« NEXT' ); ?></div>
|
34
|
-
<div class="alignright"><?php next_posts_link( 'PREV »' ); ?></div>
|
35
|
-
</div>
|
36
|
-
<?php endif; /** ページャーここまで */ ?>
|
37
31
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
<?php
|
42
|
-
/****************************************
|
43
|
-
|
44
|
-
Template Name: page-blog.php
|
45
|
-
/bloglist/ slug attribute temaplete
|
46
|
-
|
47
|
-
home.php 作成したのでindex.php 使えないので 代わりにbloglist 使用する。
|
48
|
-
全ての記事ページを表示するための
|
49
|
-
テンプレートファイルです。
|
50
|
-
カスタマイズした index.phpです。
|
51
|
-
(CHAPTER 17)
|
52
|
-
|
53
|
-
*****************************************/
|
54
|
-
get_header();
|
55
|
-
//get_header('megamenu');
|
56
|
-
?>
|
57
|
-
<!-- index.php -->
|
58
|
-
<!--Bootstrap Container Grid変更する場合 コンパイル変更してください。<div class="container">-->
|
59
|
-
<!--WordPressブログ全記事一覧コード-->
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
<!--ここにMain ID コンテンツ-->
|
64
|
-
|
65
|
-
<div id="main">
|
66
|
-
|
67
|
-
<!--WP query loop starts-->
|
68
|
-
<?php
|
69
|
-
$wp_query = new WP_Query();
|
70
|
-
$my_posts01 = array(
|
71
|
-
'post_type' => 'post',
|
72
|
-
'category_name' => 'Tekken',
|
73
|
-
'posts_per_page'=> '10',
|
74
|
-
);
|
75
|
-
$wp_query->query( $my_posts01 );
|
76
|
-
if( $wp_query->have_posts() ): while( $wp_query->have_posts() ) : $wp_query->the_post();
|
77
|
-
?>
|
78
|
-
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
79
|
-
|
80
|
-
<div class="content-box">
|
81
|
-
|
82
|
-
<a href="<?php the_permalink(); ?>"class="badge badge-primary"><?php the_title(); //Bootstrap色 Bootstrap見出しを大きくh4?></a>
|
83
|
-
|
84
|
-
<p class="post-meta">
|
85
|
-
|
86
|
-
<svg class="icon icon-clock">
|
87
|
-
|
88
|
-
<use xlink:href="#icon-clock">
|
89
|
-
|
90
|
-
<span class="post-date"><?php the_time( get_option( 'date_format' ) ); ?></span>
|
91
|
-
|
92
|
-
</use>
|
93
|
-
|
94
|
-
</svg>
|
95
|
-
|
96
|
-
<span class="category"><!--Category--><?php the_category( ', ' ) ?></span>
|
97
|
-
<!--<p class="sidebar-comment-num"><?php //comments_popup_link( 'Comment : 0', 'Comment : 1', 'Comments : %' ); ?></p>-->
|
98
|
-
<span class="sidebar-comment-num">
|
99
|
-
<?php comments_popup_link( '<i class="far fa-comments"></i> : 0', '<i class="far fa-comments"></i> : 1', '<i class="far fa-comments"></i> : %' ); ?>
|
100
|
-
</span>
|
101
|
-
|
102
32
|
</p>
|
103
33
|
|
104
34
|
|
@@ -116,14 +46,7 @@
|
|
116
46
|
<a href="<?php the_permalink(); ?>" title="「<?php the_title(); ?>」の続きを読む">
|
117
47
|
<?php
|
118
48
|
|
119
|
-
if( has_post_thumbnail() ) :
|
120
|
-
|
121
|
-
$blog_thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array(600,600) );
|
122
|
-
echo '<div class="blog-post-image" style="background-image:url('.$blog_thumbnail[0].')"></a>';
|
123
|
-
echo '<h3><a href="'.get_the_permalink().'">'.get_the_title().'</a></h3>';
|
124
|
-
echo '</div>';
|
125
|
-
|
126
|
-
|
49
|
+
if( post-image” style=”background-image:url(/images/noimage.gif);”></div>’;
|
127
50
|
<?php endif; ?>
|
128
51
|
</a>
|
129
52
|
</div>
|
@@ -140,45 +63,7 @@
|
|
140
63
|
|
141
64
|
|
142
65
|
<?php if ( $wp_query->max_num_pages > 1 ) : /** ここからページャー */ ?>
|
143
|
-
<div class="navigation">
|
144
|
-
<div class="alignleft"><?php previous_posts_link( '« NEXT' ); ?></div>
|
145
|
-
<div class="alignright"><?php next_posts_link( 'PREV »' ); ?></div>
|
146
|
-
</div>
|
147
|
-
<?php endif; /** ページャーここまで */ ?>
|
148
|
-
|
149
|
-
|
150
|
-
</div>
|
151
|
-
<!--main id end-->
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
<?php
|
156
|
-
get_sidebar('test');
|
157
|
-
get_footer('home1');
|
158
|
-
?>
|
159
|
-
|
160
|
-
|
161
|
-
試したこと追加:
|
162
|
-
gif 画像は表示されないがバックグランドが表示された。
|
163
|
-
<?php /** アイキャッチ画像(CHAPTER 14)*/ ?>
|
164
|
-
<div class="blog-thumbnail-box">
|
165
|
-
<a href="<?php the_permalink(); ?>" title="「<?php the_title(); ?>」の続きを読む">
|
166
|
-
<?php
|
167
|
-
|
168
|
-
if( has_post_thumbnail() ) :
|
169
|
-
|
170
|
-
$blog_thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array(600,600) );
|
171
|
-
$noimage = get_template_directory_uri() . '/images/noimage.gif';
|
172
|
-
|
173
|
-
|
174
|
-
echo '<div class="blog-post-image" style="background-image:url('.$blog_thumbnail[0].')"></a>';
|
175
|
-
echo '<h3><a href="'.get_the_permalink().'">'.get_the_title().'</a></h3>';
|
176
|
-
echo '</div>';
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
else : ?> <div class=”blog-post-image” style="background-image: url( '<?php echo $noimage; ?>' );"></div>
|
181
|
-
|
66
|
+
endif; ?>
|
182
67
|
</a>
|
183
68
|
</div>
|
184
69
|
<!--thumbnail-box end-->
|
4
追加の写真と説明
title
CHANGED
File without changes
|
body
CHANGED
@@ -181,4 +181,8 @@
|
|
181
181
|
<?php endif; ?>
|
182
182
|
</a>
|
183
183
|
</div>
|
184
|
-
<!--thumbnail-box end-->
|
184
|
+
<!--thumbnail-box end-->
|
185
|
+
|
186
|
+
追加の写真と説明だよ:
|
187
|
+
わかりやすく追加の情報:
|
188
|
+
前に進(previous_posts_link)んでも 次の進(next_posts_link)んでも 同じ10枚の背景画像しか表示されない。
|
3
情報の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
問題:
|
1
|
+
問題:
|
2
2
|
下記のコードで、背景画像で記事維一覧を全て表示することはできたが、
|
3
3
|
'Pagination' コードを設置すると次と前のページでも同じ背景画像の記事一覧しか表示されないです。
|
4
4
|
|
2
情報もれ
title
CHANGED
File without changes
|
body
CHANGED
@@ -155,4 +155,30 @@
|
|
155
155
|
<?php
|
156
156
|
get_sidebar('test');
|
157
157
|
get_footer('home1');
|
158
|
-
?>
|
158
|
+
?>
|
159
|
+
|
160
|
+
|
161
|
+
試したこと追加:
|
162
|
+
gif 画像は表示されないがバックグランドが表示された。
|
163
|
+
<?php /** アイキャッチ画像(CHAPTER 14)*/ ?>
|
164
|
+
<div class="blog-thumbnail-box">
|
165
|
+
<a href="<?php the_permalink(); ?>" title="「<?php the_title(); ?>」の続きを読む">
|
166
|
+
<?php
|
167
|
+
|
168
|
+
if( has_post_thumbnail() ) :
|
169
|
+
|
170
|
+
$blog_thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array(600,600) );
|
171
|
+
$noimage = get_template_directory_uri() . '/images/noimage.gif';
|
172
|
+
|
173
|
+
|
174
|
+
echo '<div class="blog-post-image" style="background-image:url('.$blog_thumbnail[0].')"></a>';
|
175
|
+
echo '<h3><a href="'.get_the_permalink().'">'.get_the_title().'</a></h3>';
|
176
|
+
echo '</div>';
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
else : ?> <div class=”blog-post-image” style="background-image: url( '<?php echo $noimage; ?>' );"></div>
|
181
|
+
<?php endif; ?>
|
182
|
+
</a>
|
183
|
+
</div>
|
184
|
+
<!--thumbnail-box end-->
|
1
情報もれ
title
CHANGED
File without changes
|
body
CHANGED
@@ -33,4 +33,126 @@
|
|
33
33
|
<div class="alignleft"><?php previous_posts_link( '« NEXT' ); ?></div>
|
34
34
|
<div class="alignright"><?php next_posts_link( 'PREV »' ); ?></div>
|
35
35
|
</div>
|
36
|
-
<?php endif; /** ページャーここまで */ ?>
|
36
|
+
<?php endif; /** ページャーここまで */ ?>
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
<?php
|
42
|
+
/****************************************
|
43
|
+
|
44
|
+
Template Name: page-blog.php
|
45
|
+
/bloglist/ slug attribute temaplete
|
46
|
+
|
47
|
+
home.php 作成したのでindex.php 使えないので 代わりにbloglist 使用する。
|
48
|
+
全ての記事ページを表示するための
|
49
|
+
テンプレートファイルです。
|
50
|
+
カスタマイズした index.phpです。
|
51
|
+
(CHAPTER 17)
|
52
|
+
|
53
|
+
*****************************************/
|
54
|
+
get_header();
|
55
|
+
//get_header('megamenu');
|
56
|
+
?>
|
57
|
+
<!-- index.php -->
|
58
|
+
<!--Bootstrap Container Grid変更する場合 コンパイル変更してください。<div class="container">-->
|
59
|
+
<!--WordPressブログ全記事一覧コード-->
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
<!--ここにMain ID コンテンツ-->
|
64
|
+
|
65
|
+
<div id="main">
|
66
|
+
|
67
|
+
<!--WP query loop starts-->
|
68
|
+
<?php
|
69
|
+
$wp_query = new WP_Query();
|
70
|
+
$my_posts01 = array(
|
71
|
+
'post_type' => 'post',
|
72
|
+
'category_name' => 'Tekken',
|
73
|
+
'posts_per_page'=> '10',
|
74
|
+
);
|
75
|
+
$wp_query->query( $my_posts01 );
|
76
|
+
if( $wp_query->have_posts() ): while( $wp_query->have_posts() ) : $wp_query->the_post();
|
77
|
+
?>
|
78
|
+
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
79
|
+
|
80
|
+
<div class="content-box">
|
81
|
+
|
82
|
+
<a href="<?php the_permalink(); ?>"class="badge badge-primary"><?php the_title(); //Bootstrap色 Bootstrap見出しを大きくh4?></a>
|
83
|
+
|
84
|
+
<p class="post-meta">
|
85
|
+
|
86
|
+
<svg class="icon icon-clock">
|
87
|
+
|
88
|
+
<use xlink:href="#icon-clock">
|
89
|
+
|
90
|
+
<span class="post-date"><?php the_time( get_option( 'date_format' ) ); ?></span>
|
91
|
+
|
92
|
+
</use>
|
93
|
+
|
94
|
+
</svg>
|
95
|
+
|
96
|
+
<span class="category"><!--Category--><?php the_category( ', ' ) ?></span>
|
97
|
+
<!--<p class="sidebar-comment-num"><?php //comments_popup_link( 'Comment : 0', 'Comment : 1', 'Comments : %' ); ?></p>-->
|
98
|
+
<span class="sidebar-comment-num">
|
99
|
+
<?php comments_popup_link( '<i class="far fa-comments"></i> : 0', '<i class="far fa-comments"></i> : 1', '<i class="far fa-comments"></i> : %' ); ?>
|
100
|
+
</span>
|
101
|
+
|
102
|
+
</p>
|
103
|
+
|
104
|
+
|
105
|
+
</a>
|
106
|
+
<?php //the_excerpt(); /** 抜粋(CHAPTER 14)*/
|
107
|
+
/** 続きを読むリンク */ ?>
|
108
|
+
<?php echo dess_get_excerpt(280); ?>
|
109
|
+
<p class="more-link">
|
110
|
+
<a href="<?php the_permalink(); ?>" title="「<?php the_title(); ?>」の続きを読む"><span class="badge badge-success">続きを読む »</span></a>
|
111
|
+
</p>
|
112
|
+
</div>
|
113
|
+
<!--content box end-->
|
114
|
+
<?php /** アイキャッチ画像(CHAPTER 14)*/ ?>
|
115
|
+
<div class="blog-thumbnail-box">
|
116
|
+
<a href="<?php the_permalink(); ?>" title="「<?php the_title(); ?>」の続きを読む">
|
117
|
+
<?php
|
118
|
+
|
119
|
+
if( has_post_thumbnail() ) :
|
120
|
+
|
121
|
+
$blog_thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array(600,600) );
|
122
|
+
echo '<div class="blog-post-image" style="background-image:url('.$blog_thumbnail[0].')"></a>';
|
123
|
+
echo '<h3><a href="'.get_the_permalink().'">'.get_the_title().'</a></h3>';
|
124
|
+
echo '</div>';
|
125
|
+
|
126
|
+
else : ?> echo ‘<div class=”blog-post-image” style=”background-image:url(/images/noimage.gif);”></div>’;
|
127
|
+
<?php endif; ?>
|
128
|
+
</a>
|
129
|
+
</div>
|
130
|
+
<!--thumbnail-box end-->
|
131
|
+
</div>
|
132
|
+
<!--post id end-->
|
133
|
+
<?php endwhile;
|
134
|
+
|
135
|
+
|
136
|
+
endif;
|
137
|
+
|
138
|
+
wp_reset_postdata(); ?>
|
139
|
+
<!--WP query loop end-->
|
140
|
+
|
141
|
+
|
142
|
+
<?php if ( $wp_query->max_num_pages > 1 ) : /** ここからページャー */ ?>
|
143
|
+
<div class="navigation">
|
144
|
+
<div class="alignleft"><?php previous_posts_link( '« NEXT' ); ?></div>
|
145
|
+
<div class="alignright"><?php next_posts_link( 'PREV »' ); ?></div>
|
146
|
+
</div>
|
147
|
+
<?php endif; /** ページャーここまで */ ?>
|
148
|
+
|
149
|
+
|
150
|
+
</div>
|
151
|
+
<!--main id end-->
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<?php
|
156
|
+
get_sidebar('test');
|
157
|
+
get_footer('home1');
|
158
|
+
?>
|