我有一个循环,它接受顶级的cat_id。"Data",循环遍历类别,将第二级显示为H2s,然后显示每个子类别中的帖子。
现在,我已经获得了第三个级别,需要将第三个级别输出为H3s,然后是posts,如
我很难弄清楚我们该如何调侃这个新的水平。以下是当前的两级循环:
$cat_id )
);
foreach ( $child_categories as $child ) { ?>
cat_name;
$className = str_replace(' ', '', $string);
?>
cat_name; ?>
$child->cat_name, 'posts_per_page' => -1, 'paged' => $paged, 'orderby' => 'title', 'order' => 'ASC' );
$loop = new WP_Query( $args ); ?>
have_posts() ) : $loop->the_post(); ?>发布于 2018-02-24 14:12:27
试试这个:
$cat_id )
);
foreach ( $child_categories as $child ) { ?>
cat_name;
$className = str_replace(' ', '', $string);
?>
cat_name; ?>
$child->term_id ) );
foreach ( $subchild_cats as $subchild ) :
$className = str_replace( ' ', '', $subchild->cat_name );
?>
cat_name; ?>
$subchild->cat_name, 'posts_per_page' => -1, 'paged' => $paged, 'orderby' => 'title', 'order' => 'ASC' );
$loop = new WP_Query( $args ); ?>
have_posts() ) : $loop->the_post(); ?>https://wordpress.stackexchange.com/questions/294954
复制相似问题