Our website: www.cinemanext.at basically shows the first child category of the category events (click page "events"). Now, page "service" shows category service, which is a child category of events. But service has more levels of child categories.
There is events -> service -> nachwuchsfoerderungen
and even one step deeper: events -> service -> nachwuchsfoerderungen -> entwicklung
, for example.
Unfortunately, in the grid boxes on the website - the place where the categories are displayed, it always shows the first child category: which is fine for the page "events" (only one level of child categories), but not for the page "service", since it has more than one level of child categories.
Is there a possibility to always display the latest child? In this case:
Service page would show: Service, I click on Nachwuchsförderungen, it should show category nachwuchsfoerderungen (and not service), If I click on Entwicklung, it should show category entwicklung (and not service)...
This code is in functions.php
function cnext_event_cat() {
static $parent_cat;
if(! isset($parent_cat))
$parent_cat = get_category_by_slug('events');
foreach(get_the_category() as $cat)
if($cat->category_parent == $parent_cat->cat_ID)
return $cat;
}
cnext_event_cat
only returns something in some situations, which is a bug, there is no fallback or default. I also visited the site and couldn't figure out what the grid referred to as everything was in german. I also noticed it commits the cardinal sin of not using hyperlinks to implement hyperlinks. Links should be<a>
tags, not<div>
tags, this is a major accessibility issue. Can you edit the Q to include more code and hard examples I can visit and see?