0
我有50个类别,每个类别都有100个帖子。我有一个页面模板,在这个页面上,我想显示类别与5-5职位,但在分页。 我已经使用下面的代码,但没有任何分页,没有任何职位只发现类别名称。从分类中获得所有类别的所有帖子
$args = array(
'type' => 'post',
'child_of' => 0,
'parent' => '',
'orderby' => 'ID',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'exclude' => '',
'include' => '',
'number' => '',
'taxonomy' => 'category',
'pad_counts' => false
);
$categories = get_categories($args);
foreach($categories as $category){ $catId[] = $category->term_id; }
$catId_comma_separated = implode(",", $catId);
$myposts = get_posts(array('numberposts' => 5, 'offset' => 0, 'cat' => $catId_comma_separated, 'post_status'=>'publish', 'order'=>'ASC'));
query_posts("cat = $catId_comma_separated");
while (have_posts()) : the_post();
echo '<li>';
the_title();
echo '</li>';
endwhile;
// Reset Query
wp_reset_query();
custom_pagination();
谢谢。我的自定义分页与其他代码一起工作正常。但不能使用此代码。离开分页主题。并请告诉我如何显示与类别名称的所有职位,只感谢.. –
你想显示所有类别或任何特定类别的所有职位? –
是的,我想显示所有类别的所有文章。留下分页的概念。 但只有一个页面只有一个类别及其所有帖子。 –