スラッグ名 (「最も人気のある」など) を使用して、カテゴリの下にあるすべての投稿を取得したいと考えています。どうすればいいですか?
これは私が試したものですが、失敗しました。
<?php
global $post;
$id = array();
$i=0;
$args = array( 'numberposts' => 5, 'category' => "most-popular", 'post_status' => "publish", 'order'=>"ASC");
$myposts = get_posts( $args );
foreach( $myposts as $post ) :
setup_postdata($post);
$id[$i]=$post->ID;
$i=$i+1;
endforeach;
$article1= new Article($id[0]);
$article2= new Article($id[1]); //and so on.
?>