我有类别列表,如
Designtype
Multi
Sub cat multi 1
sub cat multi 2
Borring
Jall
Daman
Dupatta
top parsi
Sequence
Trapping
我想显示jall damna dupatta和top parsi的最后一篇文章
答案 0 :(得分:0)
<?php
$cat = get_categories();
echo “<pre>”;
//print_r($cat);
for each ($cat as $c)
{
if($c->cat_name == “Boring”)
{
$sub_cat = $c->term_id;
$cat2 = get_categories();
for each ($cat2 as $c2)
{
if($c2->parent == $sub_cat)
{
echo “<pre>”;
echo $c2->cat_name;
echo “<br/>”;
$aaaaaaaaaaaaaa = query_posts(array(‘category_name’ => $c2->cat_name, ‘posts_per_page’ => 1 ));
print_r($aaaaaaaaaaaaaa);
} } } }
&GT;