ショートコードAPIを使った投稿記事一覧を表示する場合のページネーショ
-
いつもありがとうございます。
ショートコードAPIをfunctions.phpに配置して
固定ページに投稿記事一覧を表示させることができましたが、
記事が増えてくる場合、ページネーションが必要になります。この場合、ページネーションはどのようにしたらいいのでしょうか。
ショートコードは下記の内容で配置しました。
//ショートコード
function getCatItems($atts, $content = null) {
extract(shortcode_atts(array(
“num” => ‘5’,
“cat” => ”
), $atts));
global $post;
$oldpost = $post;
$myposts = get_posts(‘numberposts=’.$num.’&order=DESC&orderby=post_date&category=’.$cat);
$retHtml=’- ‘;
foreach($myposts as $post) :
setup_postdata($post);
$retHtml.='<li class=”blog-list”>‘.the_title(“”,””,false).’‘.the_date().”;
endforeach;
$retHtml.=’‘;
$post = $oldpost;
return $retHtml;
}
add_shortcode(“list”, “getCatItems”);よろしくお願いいたします。
2件の返信を表示中 - 1 - 2件目 (全2件中)
2件の返信を表示中 - 1 - 2件目 (全2件中)
トピック「ショートコードAPIを使った投稿記事一覧を表示する場合のページネーショ」には新たに返信することはできません。