Support » Fixing WordPress » Show Parent and Sub/Sub-Sub Categories on Post

  • Hiya, it’s me again. Just wondering if anyone is willing to help me out on this.

    How can you only show the parent and Sub/Sub-Sub Categories on a single post?

    Tried this code below, but it shows the whole list of categories.

    <?php
    // show_count=1 causes undefined index notice in WP3.0. Set to 0 to get rid until they fix in WP.
    $catQueryString = ‘hide_empty=0&orderby=id&title_li=&use_desc_for_title=1&taxonomy=category&depth=0&child_of=’ . $this_category->cat_ID;
    wp_list_categories($catQueryString);
    ?>

    I’m using wordpress 2010 theme. Many Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • what is a ‘parent category’ on/in a single post?

    to start with, a post can have multiple categories.

    (you would ‘normally’ use the_category() to do this in a single post)

    do you want to list all these categories
    and their possible children
    and the possible children of the chldren?

    in which ‘order’ do you want the results, i.e. does this need to show the hierarchy of the categories?

    related:
    http://codex.wordpress.org/Function_Reference/get_the_category
    http://codex.wordpress.org/Function_Reference/get_categories

    Thread Starter heronakamura

    (@heronakamura)

    Sorry to be vague. At the minute, each post is only published on a single category or subcategory or sub-subcategory. However, there maybe some occasions in the future where a single post may apply to 2-3 categories. Now, it just got a little more complicated.

    I’m using breadcrumb navxt already, so perhaps that would do for now if this is a complicated question. Do you think it’s better to just show related posts whilst reader is in a post? Just thought related categories might help as well.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show Parent and Sub/Sub-Sub Categories on Post’ is closed to new replies.