0
我有50個類別,我想在頁面上顯示10個類別,在下一頁顯示10個類別,在下一個頁面上顯示下一個10,以此類推導航。 我正在使用此代碼。
但是沒有任何導航創建。 但如何獲得導航。如何使用導航獲取類別?
$args = array(
'type' => 'post',
'child_of' => 0,
'parent' => '',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'exclude' => '',
'include' => '',
'number' => '0,10',
'taxonomy' => 'category',
'pad_counts' => false
);
$categories = get_categories($args);
// loop through the categries
foreach ($categories as $category) {
$cat_link = get_category_link($category->cat_ID);
echo '<a href="'.$cat_link.'">'.$category->name.'</a>'; // category link
echo "</br>";
}
?>
我的代碼工作正常,並獲得所有類別。我只需要導航。 thanx你能幫我這個.. –
如果這不能解決你的問題我猜這個問題的其他地方(你的其他代碼,類$ category,...) – dabe