Skip Navigation

[Resolved] group results by category

This support ticket is created 7 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 7 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#407483

hej toolset.

i'd like to display lot's of results grouped …
(like > https://toolset.com/2015/07/how-to-group-posts-by-category/)

… by hirachial categories …
(almost like > https://toolset.com/forums/topic/hide-posts-on-category-parent/)

… but resolve the parent 'problem' dynamically!

for example …

in my tree categories are checked/marked like this … (o=unchecked, x=checked)

parent > x
- child level 1 > o
-- child level 2 > x

the output should be something like …

Category Name of my parent category
listing of results parent
-
NO Category Name because has no marked data
listing of results child level 1 is empty (child level 2 are NOT included)
-
Category Name of my child level 2 category
listing of results child level 2

any ideas?

thanks for your great support in advance!

best,
s

#407760

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand, you want to display result as:

Parent Category Name:
--- Child level 2 cartegory name
-------- child level 2 post 1
-------- child level 2 post 2
-------- child level 2 post 3

is this correct? If yes, how you store checkmark value to database if category is checked?

#407781

hej minesh.

let me start from the end of your post: we are talking about regular hierarchal taxonomy (like category) and as far as i know those are store with ids in tables wp_term and wp_term_relationships.

talking about regular categories i can set parent on any level. editing my posts i can now select individually each level from parent, child to 'sub-child' (and so on).

the special on my request is, that i'd like to output with parent those which are MARKED with parent, not those which are 'only' marked with (of course belonging but) whatever subcategory.

only the loop processes the e.g. sub-level-2 i'd like to output exactly those values. (which is default)

not default is again that those sub-level-2 shall not be displayed in sub-level-1. (in general this is the same idea as in parent-top-category, but not 'checked in category tree' and therefore no output for that level.

please let me know if that needs a more detailed example.

best,
s

#407787

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - I understand what you are saying. Basically - you need to start from top parent category and display parent category and further display its child category and posts belongs to that child category. if child category has no post, do not display child category. I hope I understood well.

Could you please share problem URL and exactly what output you want with test example.

#407992

ok. but sorry for coming up with words one more time, because i probably must got the right intension…

i am looking for a dynamic loop that output on each level just the checked items.
(no items checked, no output)

an example: let's see …

date structure (post-title - categories)
--
my item 1 - parent, level 2
my item 2 - parent
my item 3 - level 2

output
--
++ parent ++ (as whatever heading)
my item 1
my item 2
++ level 2 ++ (as whatever same heading type)
my item 1
my item 3

conditional with NO output
--
++ level 1 ++

but generally as mentioned at the beginning: is't about forcing to only output checked categories.

#408256

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

1)
you should create a View which list all master category and one chose by you,
=> Add Filter: Taxonomy filter where taxonomy with parent = none

2)
=> Create a another view that will list all "child categories" Filters by taxonomy and add the taxonomy filter "Parent is the taxonomy selected by the parent Taxonomy View" and save

3)
=> Create another view that will list "all posts" related to your "child category" and add the taxonomy filter and select "Set by parent taxonomy view" and dispaly your post contents.

Please check following documentation links, that may help you:
=> https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/
=> https://toolset.com/documentation/user-guides/passing-arguments-to-views/

As described by Beda here, you can conditionally display the view output:
https://toolset.com/forums/topic/hide-posts-on-category-parent/#post-381826

This solution may help you - you should just follow the way:
https://toolset.com/forums/topic/how-can-i-display-sub-categories-in-grid/page/2/#post-339259

If you still need further assistance, just create your taxonomies and structure and if you stuck, please do not hesitate to get in touch with me with problem URLs.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.