• Marcin

    (@marcinkopec)


    Hi,
    before I wrote this I checked different topics however
    I did’t find the answer.
    I have to list categories even if they are empty. I use this code

    $args = array('hide_empty'=>0, 'child_of' => 2,'pad_counts' => true);
    $categories = get_categories( $args );
    
    ?>
    <div class="mk_hidden_menu">
    <ul>
    <?php
    foreach($categories as $category)
    {
    echo '<li class="mk_second_navigation_block"><a class="mk_second_navigation_a" href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> </li> ';
    }
    ?>
    </ul>
    </div>

    It list sub-categories name only if there are not empty. Option ‘hide_empty’=>0 doesn’t change anything I read documentation and similar topics. For most of ‘us’ ‘hide_empty’=>0 solve it, but not this time
    Any help?

  • The topic ‘List empty sub-categories’ is closed to new replies.