WordPress.org

Ready to get started?Download WordPress

Forums

Display all sub categories and posts within? (7 posts)

  1. silencematters
    Member
    Posted 8 years ago #

    + 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

  2. silencematters
    Member
    Posted 8 years ago #

    Does this make sense? Is it too easy of a question? Or is it not worded clear enough?

  3. Joshua Sigar
    Member
    Posted 8 years ago #

    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

  4. silencematters
    Member
    Posted 8 years ago #

    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 ); ?>

  5. silencematters
    Member
    Posted 8 years ago #

    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.

  6. Joshua Sigar
    Member
    Posted 8 years ago #

    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.

  7. silencematters
    Member
    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags