WordPress.org

Ready to get started?Download WordPress

Forums

Posts Only Show in Sub Categories, Missing from Parent Category (1 post)

  1. jchambo
    Member
    Posted 10 months ago #

    Greetings,

    First I would like to thank everyone for their help in advance.

    So my issue at hand is that on my Category pages, if I have a Sub Category the posts show up in those Sub Categories just fine. But when I go to the Parent Category, nothing shows up.

    For Instance, I have the following as an example:

    Access Forms
    -System Wide
    -Network Security

    The posts show fine in the System Wide Category, but when I go to the Access Forms category, nothing shows. I do have both categories checked as well in the Post.

    Here is my category.php file for Sub Categories being listed:

    <!-- #sub-cats -->
    <?php
    // Sub category
    $st_sub_category_id = get_query_var('cat');
    
    $st_subcat_args = array(
      'orderby' => 'name',
      'order' => 'ASC',
      'child_of' => $st_sub_category_id,
      'parent' => $st_sub_category_id
    
    );
    
    $st_sub_categories = get_categories($st_subcat_args);
    
    if ($st_sub_categories) { ?>
    <ul class="sub-categories clearfix">
    <?php foreach($st_sub_categories as $st_sub_category) {  ?>
    <li><h4><a href="<?php echo get_category_link( $st_sub_category->term_id ) ?>"><?php echo $st_sub_category->name ?></a><?php if (of_get_option('st_hp_subcat_counts') == '1') {
    			echo '<span class="cat-count">(' . $st_sub_category->count.')</span>';
    		} ?></h4></li>
    
    <?php } ?>
    </ul>
    <?php } ?>
    <!-- #/sub-cats -->

    Any help would be appreciated!

Reply

You must log in to post.

About this Topic