Here is my code. It works fine but it only show maximum 5 subcategory under category. There have 10 to 20+ subcategory for every category. Now what is fault in my code...
I want to print all subcategory under every category. How? Please help...
<?php
$args = array(
'taxonomy' => 'custom_taxo',
'parent' => 0,
'orderby' => 'name',
'order' => 'ASC',
'hierarchical' => 1,
'hide_empty' => 1,
'pad_counts' =>0
);
$categories = get_categories( $args );
foreach ( $categories as $category ){
echo "<li class='biz-cat'>";
echo '<label><input type="checkbox" id="type-'. $category->name . '" rel="'. $category->name . '">' . $category->name . '</label>';
$sub_args = array(
'taxonomy' => 'custom_taxo',
'parent' => $category->term_id,
'orderby' => 'name',
'order' => 'ASC',
'hierarchical' => 1,
'hide_empty' => 1,
'pad_counts' => 0
);
$sub_categories = get_categories( $sub_args );
echo "<ul class='children'>";
foreach ( $sub_categories as $sub_category ){
echo "<li>";
echo '<label><input type="checkbox" id="type-'. $sub_category->name . '" rel="'. $sub_category->name . '"> '. $sub_category->name . '</label>';
echo "</li>";
}
echo "</ul>";
echo "</li>";
}
Aucun commentaire:
Enregistrer un commentaire