Site logo

Archived topic

Parent Category

3 replies · Started by Mark on October 16, 2018

Viewing posts 1–4 of 4

Hello,
I would like to replace the default category list in posts where all categories are displayed in one line for more separate lists sorted by the parent category. Example

standard categories list:
CATEGORIES: ssd, samsung, hdd, seagate, crucial, corsair, western digital

Parent categories list:
SSD: samsung, crucial, corsair
HDD: seagate, western digital

What is the right hook? Thanks!

Hi there,

You can filter the current categories like this:

add_filter( 'generate_category_list_output', function() {
    // Your parent/child category code here.
} );

I'm not sure what the code would be to separate your categories like that off hand though. If you're not sure, it may be worth asking over on https://wordpress.stackexchange.com/.

Let me know if this helps or not :)

Hi Tom,

this is the answer I've got :D

"The filter you mention is not standard WordPress but GeneratePress. You'll have to ask on their forum (or the theme that uses it). – cjbj 4 hours ago"

Yes, the filter itself is a GeneratePress filter.

However, it just defines where the code within it is placed (like a hook).

It's the code inside that we're interested in. The GeneratePress filter itself can be completely ignored.

This archived topic is closed to new replies.