質問編集履歴
1
すみません、ソースと追加致しました。宜しくお願い致します。
test
CHANGED
File without changes
|
test
CHANGED
@@ -63,3 +63,87 @@
|
|
63
63
|
ググってみたのですが、それっぽいのが見つからず...
|
64
64
|
|
65
65
|
どなたかご教示いただけると助かります。
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
### ソースの追加
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
ループ処理でお気に入りを取得し、next_posts_linkでページ送りしています。
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
```
|
84
|
+
|
85
|
+
<div class="favlist">
|
86
|
+
|
87
|
+
<ul>
|
88
|
+
|
89
|
+
<?php
|
90
|
+
|
91
|
+
$favorites = get_user_favorites();
|
92
|
+
|
93
|
+
krsort( $favorites );
|
94
|
+
|
95
|
+
if ( $favorites ):
|
96
|
+
|
97
|
+
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
|
98
|
+
|
99
|
+
$favorites_query = new WP_Query( array(
|
100
|
+
|
101
|
+
'post_type' => 'post',
|
102
|
+
|
103
|
+
'posts_per_page' => 5,
|
104
|
+
|
105
|
+
'ignore_sticky_posts' => true,
|
106
|
+
|
107
|
+
'post__in' => $favorites,
|
108
|
+
|
109
|
+
'paged' => $paged,
|
110
|
+
|
111
|
+
'orderby' => 'post__in'
|
112
|
+
|
113
|
+
) );
|
114
|
+
|
115
|
+
if ( $favorites_query->have_posts() ):
|
116
|
+
|
117
|
+
while ( $favorites_query->have_posts() ): $favorites_query->the_post();
|
118
|
+
|
119
|
+
?>
|
120
|
+
|
121
|
+
<li> ~中略~ </li>
|
122
|
+
|
123
|
+
<?php endwhile;?>
|
124
|
+
|
125
|
+
<?php
|
126
|
+
|
127
|
+
else :
|
128
|
+
|
129
|
+
echo 'お気に入りはありません';
|
130
|
+
|
131
|
+
endif;
|
132
|
+
|
133
|
+
?>
|
134
|
+
|
135
|
+
<?php endif; ?>
|
136
|
+
|
137
|
+
</ul>
|
138
|
+
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div class="next">
|
142
|
+
|
143
|
+
<?php next_posts_link('次のページへ', $favorites_query->max_num_pages); ?>
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
```
|