質問編集履歴
3
余計なもの消去
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,8 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
``` <?php $favorites = get_user_favorites(); ?>
|
7
|
-
<?php $paged = get_query_var('paged') ? get_query_var('paged'):1;
|
7
|
+
<?php $paged = get_query_var('paged') ? get_query_var('paged'):1;
|
8
|
-
$c = count($favorites)
|
9
8
|
$args2 = array('posts_per_page' => 16,
|
10
9
|
'post__in' => $favorites,
|
11
10
|
'paged' => $paged);
|
2
まちがっていたので編集しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
固定ページでのサブループWP_Queryでpost per pageの値より記事数が少ないと記事が表示されないのはなんで?
|
2
2
|
|
3
3
|
解決策は?
|
4
4
|
|
1
コードを記述しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,3 +1,60 @@
|
|
1
|
-
固定ページでのサブループWP_Queryでpost per pageの値より記事数が少ないと記事が表示されないのはなんで?
|
1
|
+
```固定ページでのサブループWP_Queryでpost per pageの値より記事数が少ないと記事が表示されないのはなんで?
|
2
2
|
|
3
|
-
解決策は?
|
3
|
+
解決策は?
|
4
|
+
|
5
|
+
|
6
|
+
``` <?php $favorites = get_user_favorites(); ?>
|
7
|
+
<?php $paged = get_query_var('paged') ? get_query_var('paged'):1;
|
8
|
+
$c = count($favorites)
|
9
|
+
$args2 = array('posts_per_page' => 16,
|
10
|
+
'post__in' => $favorites,
|
11
|
+
'paged' => $paged);
|
12
|
+
$the_query2 = new WP_Query($args2);
|
13
|
+
$n=1; ?>
|
14
|
+
|
15
|
+
<div class="mypostlist">
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
<?php if($the_query2 -> have_posts()) : while($the_query2 -> have_posts()) : $the_query2 -> the_post();
|
20
|
+
?>
|
21
|
+
<div class="aida2">
|
22
|
+
<?php the_title(); ?><br>
|
23
|
+
<?php echo $n ;?>
|
24
|
+
<?php if(has_post_thumbnail()): ?>
|
25
|
+
<a href="<?php the_permalink() ?>">
|
26
|
+
|
27
|
+
<?php the_post_thumbnail('index_thumbnail',array('class' => 'forsize')); ?>
|
28
|
+
</a>
|
29
|
+
|
30
|
+
<?php else: ?>
|
31
|
+
<a href="<?php the_permalink() ?>">
|
32
|
+
<img src="<?php echo get_stylesheet_directory_uri(); ?>/no-image.png" class="ichiran" >
|
33
|
+
</a>
|
34
|
+
<?php endif; ?>
|
35
|
+
<?php $n++; ?>
|
36
|
+
<br>
|
37
|
+
<dl>
|
38
|
+
<dt>
|
39
|
+
<?php the_time('Y.m.d') ?>
|
40
|
+
<?php the_tags() ?>
|
41
|
+
</dt>
|
42
|
+
</dl>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<?php endwhile; ?>
|
47
|
+
<?php else: ?>
|
48
|
+
<p>お気に入りがありません</p>
|
49
|
+
<?php endif; ?>
|
50
|
+
</div> <?php wp_reset_postdata(); ?>
|
51
|
+
<?php
|
52
|
+
if (function_exists('pagination')) {
|
53
|
+
$GLOBALS['wp_query']->max_num_pages = $the_query->max_num_pages;
|
54
|
+
$max_num_pages = $the_query->max_num_pages;
|
55
|
+
pagination($max_num_pages);
|
56
|
+
}
|
57
|
+
?>
|
58
|
+
|
59
|
+
コード
|
60
|
+
````
|