• So I’m not that great at coding, but I came up with a template for my category archive page that I want to display the subcategories of the current category if there are any, if not just display all the posts.

    First: the IF/ELSE to check if the category has children doesn’t seem to be coming back as true. I created a subcategory and populated it, but it’s not triggering on the parent category page.

    Second: I can’t seem to get it to select and display the child categories. Not sure if what I put in the array would work or not.

    It doesn’t seem to be working and I can’t figure it out. Please help.

    https://pastebin.com/Y56EXgrR

Viewing 1 replies (of 1 total)
  • Thread Starter lorddemos90

    (@lorddemos90)

    I’m closer. Much closer. The code is working now, the only problem is that the category page is “still” showing all the posts along with the subcategory. For some reason the “else” section is happening regardless of the true or false. Somebody throw me a bone.

    https://pastebin.com/hkmDdNqm

Viewing 1 replies (of 1 total)
  • The topic ‘Display Subcategory If Category Page Has Children’ is closed to new replies.