• Ok… lets see how I can explain myself..

    #0 – Parent
    #1 – Child
    #2 – Grandchild

    https://wordpress.pastebin.ca/2025224 is currently my code.

    Now basically what I’m wanting to do is have #0 categories show #1 and not to show any posts but show posts only in #1/#2, doesnt make sense does it?

    Right now it ALMOST works.. except that the parent categories when viewed, shows the child categories, which is what I’m expecting but it also shows the grandchild & great grandchild as well as any posts posted under those categories, I want to take those out.

    I was never a good explainer but hope this makes sense.
    Thanks

    – Sashi

Viewing 8 replies - 1 through 8 (of 8 total)
  • #0 – Category A
    #1 – Child of Category A
    #2 – Grandchild of Category A

    so when you are viewing #0, you want to see posts from only #1, and when viewing #1, you want to see posts from only #2?

    Thread Starter xxsashixx

    (@xxsashixx)

    Correct, and when I’m viewing #0 I would like to view #1 category as well

    #0 Category A
    #1 Child of Category A
    #2 Grandchild of Category A
    #3 Child of Category A

    when you’re viewing #0, you want to see #1 and #3?

    just making sure i have a clear picture of what you want.

    Thread Starter xxsashixx

    (@xxsashixx)

    Correct and I would like to see any posts in #2 if I’m viewing #2

    ok let me work on this. i will get back to you when i have some code.

    try this out. insert the code at the top of archive.php, and let me know if it generates your desired results.

    https://csstyle.pastebin.com/cHKcv1Sa

    Thread Starter xxsashixx

    (@xxsashixx)

    I inserted it into category.php as that would be where I would like it, but that gave me a 500 error (Yes I did add <?php tags)

    just so i can make sure: did you insert the code after get_header() ? i dont think it would make a diff, just want to make sure we have the same code going.

    if you could, insert wp_die() throughout the code, with a different message for each, so we can maybe identify where the code breaks. i’ve inserted them into the pastebin if you want to just copy from there.

    https://csstyle.pastebin.com/yZtQbwhU

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Listing child categories’ is closed to new replies.