WordPress.org

Support

Support » Themes and Templates » Display all sub categories and posts within?

Display all sub categories and posts within?

  • + Hi there… I have been digging around to make this happen, and It seems a little far fetched of a plan…

    I am trying to write the php so that when you click on a link to a category page, it then displays this:

    Category Title (the name of the link i just clicked on)

    _ Child 1 -show cat_title

    __ SubChild A -show cat_title
    ___ -show all post_titles

    __ SubChild B -show cat_title
    ___ -show all post_titles

    __ SubChild C -show cat_title
    ___ -show all post_titles

    _Child 2 -show cat_title

    __ SubChild A -show cat_title
    ___ -show all post_titles

    __ SubChild B -show cat_title
    ___ -show all post_titles

    _Child 3 -show cat_title

    __ SubChild A -show cat_title
    ___ -show all post_titles

    __ SubChild B -show cat_title
    ___ -show all post_titles

    you think it it is possible?
    -jeremy

Viewing 6 replies - 1 through 6 (of 6 total)
  • Does this make sense? Is it too easy of a question? Or is it not worded clear enough?

    Try this

    <?php single_cat_title(); ?>
    <?php $catId = get_query_var( 'cat' ); ?>
    <?php wp_list_cats( 'child_of=' . $catId ); ?>

    It doesn’t display the Posts in the category, though

    It was able to display that whole tree of information for me, thank you…. I am still looking for a way to have that last level child display post_titles…
    I can see that it would be hard…

    maybe it is a matter of changing this line to include a call for post titles?
    <?php wp_list_cats( ‘child_of=’ . $catId ); ?>

    Can someone describe for me, what the PHP is actually dong here?

    <?php $catId = get_query_var( ‘cat’ ); ?>
    <?php wp_list_cats( ‘child_of=’ . $catId ); ?>

    I am assuming that it is:

    getting the current category ID, and making a search for all of the categories within .
    Then, it is listing the categories, including the children of those categories, by ID.

    (assuming that my translation is correct)
    is it possible to have something that says –

    Now with each list of child categories that are sorted by ID, Show all available posts_titles.

    I am digging around, and this is basically what I am searching for. So if i am way off base here about what is possible with PHP let me know.

    Nothing is impossible; it’s just a matter whether I want to bother with it. You just need to modify WP’s list_cats to grab the corresponding Posts as it traverses the categories.

    yes, i am sure that it is not impossible, nor am I asking someone to do it for me.
    Thank you. I will continue to look into modifying the list_cats.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display all sub categories and posts within?’ is closed to new replies.
Skip to toolbar