Hello Stephen,
I was wondering if there is a way that the subcategories be displayed in a grid like are the events in categories.
For Example, for main category MAIN with Subcategories SUB1 and SUB2: when I click on MAIN I would like to display a grid of subcategories SUB1 and SUB2 without the posts.
Is this possible?
Thanks,
Sylvia

Sylvia
Hi Sylvia,
I’m sorry, I’m not sure what grids you’re referring to. Is this about the posterboard extension?

Stephen Harris
http://tristapki.com/corpevents/?event-category=%D1%84%D0%B8%D1%80%D0%BC%D0%B5%D0%BD%D0%B8-%D1%81%D1%8A%D0%B1%D0%B8%D1%82%D0%B8%D1%8F
The link I posted views a category with all the posts in this category.
Instead, I would like to view only the subcategories of this category.
For example, if there are three subcategories of the parent category,
I would like to see three images and titles of these three subcategories.
When I click on a subcategory, I would like to see the posts in this specific subcategory.
I hope it is clearer now.
Please, let me know.
Thank you!

Sylvia
Hi Sylvia,
I see – it is your theme producing the grids (not Event Organiser), and that confused me.
I’m going to sketch how to do this, as this is quite an involved problem, and not one that is specific to Event Organiser. WordPress only really supports displaying post types (which in our case is an event), and not taxonomy terms (i.e. event categories). But what you can do is check if you’re on a parent category page, and if so, don’t show the posts, but instead show the subcategory links.
Health warning: WordPress lets you assign posts to parent terms and not any particular child terms. This may mean that some posts are impossible to navigate to via the categories.
First you need to identify the appropriate template. This could be taxonomy-event-category.php
, taxonomy.php
or archive.php
– whichever is present in your theme. Note that taxonomy.php
applies to all taxonomies, and archive.php
is more general still (see template hierarchy).
You then need to embed the while
loop in an if
statement – that is, you only want to display the posts, if the current category being viewed isn’t an event category or it doesn’t have any children.
$event_tax_has_children = false;
if( is_tax( 'event-category' ) ){
$term = get_queried_object();
$children = get_term_children( $term->term_id, 'event-category' );
$event_tax_has_children = (bool) $children;
}
if( $event_tax_has_children ){
//Loop through $children and display links
}else{
//Normal while loop
}
$children
will be an array of term IDs (child terms of the current parent term). There’s an example of how to display a list of links on this page: http://codex.wordpress.org/Function_Reference/get_term_children.
The required mark-up will be specific to your theme, so I will leave that to you.

Stephen Harris