WordPress.org

Ready to get started?Download WordPress

Forums

Show Category title even when no posts (3 posts)

  1. Mstnorris
    Member
    Posted 6 months ago #

    How can I show the category title even when there are no posts.

    If the category has children then I would like to list the children too.

  2. gzalariya
    Member
    Posted 6 months ago #

    You can display sub category using below code

    <?php $this_cat = (get_query_var('cat')) ? get_query_var('cat') : 1; ?>
    <?php $this_category = get_category($this_cat);
    if ( $this_category->parent ) { $this_cat = $this_category->parent; } ?>
    <?php wp_list_categories('child_of=' . $this_cat . ''); ?>
  3. Mstnorris
    Member
    Posted 6 months ago #

    Where does that code go?

Reply

You must log in to post.

About this Topic