0
votes

This is really annoying me now and I can't find an answer that has actually worked anywhere on the internet.

You'll need to be familiar with Wordpress to understand.

On my website, basically I have a single page theme which displays a single post. The single post has multiple parent and child categories.

I can display all categories using

the_category(' ');

The post uses a registered custom taxonomy of wpecbd and I am trying to display ONLY the CHILD categories for that post. Can anyone help?


If you need a better understanding, basically each single post is a listing in a business directory.

The category format is

-A
-- Air Conditioning
-- Child
-- Child
-B
-- Builders
-- Child
-- Child
-C
-- Child
-- Child

The post can have multiple categories such as Air Conditioning and Builders which would fall under A and B respectively. I only want to show the child as I have no interest in displaying the parent (A/B).

I dont want to use wp_list_categories() either as I want them displayed inline

Can anybody help?

2

2 Answers

0
votes

Show Children Only of Category Displays Category links sorted by ID (sort_column=id), without showing the number of posts per Category (optioncount=0), showing only the sub-Categories titles (use_desc_for_title=0), for just the children of Category ID 8 (child_of=8).

<?php wp_list_cats('sort_column=id&optioncount=0&use_desc_for_title=0&child_of=8'); ?>
0
votes

I overcome this by removing the array_merge() which was merging both the parent and child categories together before being added to the database.

Now I don't need to worry about parent categories being displayed.