• I’m creating a film review website, and have a Parent category called “Genre”. Under this, are child categories such as “Horror”, “Thriller” etc.

    On each film review page, I’m creating a small ‘Film Details’ box, with cast, director etc. For most of the info, I’m making use of Custom Fields. But I’d also like to put the genre child categories in there, seperated by a comma. I also don’t want them outputting as links, just plain text.

    Is there any easy way to get just the child categories of another category? I’ve looked through the codex, but can’t seem to find a way to do it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Look at child_of= argument with get_categories.

    Thread Starter Monkeyboy

    (@monkeyboy)

    Thanks very much. Still took a bit of figuring out, after looking at that part of the codex, but I got there in the end. ??

    Thread Starter Monkeyboy

    (@monkeyboy)

    Actually, I thought I’d cracked this, but turns out I haven’t. Using get_categories, it seems I can only get all the child categories, when I actually want to get just the child categories relevant to the current post…

    But I can’t seem to see a parameter that would let me do this. Can anyone help?

    Well Template_Tags/get_the_category returns the categories for the current post.

    I want almost exactly what Monkeyboy wants except that I want to have the current category’s child displayed as a link.

    As far as I figured it out get_the_category does not provide child_of functionality, hence I can’t get the child of a certain current category displayed.

    My example:

    Post A is filed under parent category Celebrities (id 1) and child category Brad Pitt (id 2). What I want to get displayed in the post is the child category link as the cat name (<a href="#categorylink">Brad Pitt</a>).

    Brad Pitt Brithday is 12/18/1964

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How do I grab just the children of a parent category?’ is closed to new replies.