投稿記事一覧を特定のタグで絞込、カテゴリー親IDの若い順して表示
-
投稿記事一覧を下記条件で表示させたいのですが、どなたか教えていただけないでしょうか。
①特定のタグで絞込
②カテゴリー親IDの若い順して表示サイト「http://appofit.com/wordpress/template-wp/shortcode-wp/
」を参考にし、①できたのですが、②ができません。function.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=parentID&post_tag='.$cat); $retHtml=' <ul>'; foreach($myposts as $post) : setup_postdata($post); $retHtml.=' <li><a href="'.get_permalink().'">'.the_content("","",false).'</a></li> '; endforeach; $retHtml.='</ul> '; $post = $oldpost; return $retHtml; } add_shortcode("list", "getCatItems");
サイトを作成し始めて1習慣ほどの素人なので、お手柔らかにお願いいたします。
2件の返信を表示中 - 1 - 2件目 (全2件中)
2件の返信を表示中 - 1 - 2件目 (全2件中)
- トピック「投稿記事一覧を特定のタグで絞込、カテゴリー親IDの若い順して表示」には新たに返信することはできません。