0
我的项目需要使用分页在一个页面中列出所有分类。分页wordpress中的分类列表
例如:我有100个类别,需要为每个页面显示10个类别,下面是数字分页。
如何在Wordpress中做到这一点?
$taxonomy = 'category';
if(!isset($_GET['showall'])):
$total_terms = wp_count_terms('category');
$pages = ceil($total_terms/$per_page);
// if there's more than one page
if($pages > 1):
echo '<ul>';
for ($pagecount = 1; $pagecount <= $pages; $pagecount++):
echo '<li><a href="'.get_term_link('news', $taxonomy).'page/'.$pagecount.'/">'.$pagecount.'</a></li>';
endfor;
echo '</ul>';
endif;
else:
endif;
它返回作为域/类别/新闻/页面/号码,但我点击页码,它返回到主页。
您能向我们展示您尝试过的代码吗?请不要指望别人为你编写完整的代码。为这项工作聘请一名自由职业者。用户在这里遇到特定的与编程有关的问题时,自愿帮助其他用户。 –
我更新了我的代码到目前为止 – ngocdung