• hkutcher

    (@hkutcher)


    Does anyone know of a way to output only the children of a parent category, for a specific post, separated by commas? This would sort of combine get_the_category and the_category.

    Say you have the following categories for the entire blog:

    • Category A
    • A.1
    • A.2
    • A.3
    • Category B
    • B.1
    • B.2
    • B.3

    And a specific post belongs to only:

    • Category A
    • A.2
    • A.3
    • Category B
    • B.1

    I want to output hyperlinked child categories, separated by commas, for each parent category:

    Category A: A.2, A.3
    Category B: B.1

    Ideally, I should also check whether this specific post belongs to any children of the parent category before writing “Category N: …”. So, if this post did not belong to any children of Category B, I would only output:

    Category A: A.2, A.3

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Combine get_the_category and the_category’ is closed to new replies.