我想得到所有类别,然后我想得到每个类别5个职位。但我的代码不起作用!http://pastebin.com/vxDSGGZk
<?php
$categories=get_categories(\'\');
foreach($categories as $category) {
echo \'<p>Category: <a href="\' . get_category_link( $category->term_id ) . \'" title="\' . sprintf( __( "View all posts in %s" ), $category->name ) . \'" \' . \'>\' . $category->name.\'</a> </p> \';
echo \'<p> Cat ID: \'. $category->cat_ID. \'</p>\';
// The Query
$id_cat = $category->cat_ID;}
$args = array(
\'cat\' => $id_cat,
\'posts_per_page\' => 5,
);
query_posts( $args );
// The Loop
while ( have_posts() ) : the_post();
echo \'<li>\';
the_title();
echo \'</li>\';
endwhile;
}
// Reset Query
wp_reset_query();
?>
请帮帮我!谢谢附言:这是我第一次在这里询问,我无法在这里粘贴代码。请检查链接粘贴箱。