if( term_exists(get_the_title(), 'category' ))
if( term_exists(get_the_title(), 'category' ))
$cat = get_term_by("slug", $post->post_name, "category");
$cat = get_term_by("slug", $post->post_name, "category");
if($cat->parent !== 0) {
if($cat->parent !== 0) {
$catID = $cat->parent;
} else {
$catID = $cat->term_id;
}
$args = array(
$args = array(
'type' => 'post',
'child_of' => $catID,
'hide_empty' => false,
'hierarchical' => true,
'exclude' => '1'
);
$categories = get_categories($args);
foreach($categories as $categorie) {
foreach($categories as $categorie) {
if($categorie->slug == $post->post_name) {
$clasa = "class='current'";
} else {
$clasa = "";
}
echo "<a ".$clasa." href='".home_url("/").$slug."/".$categorie->slug."'>".$categorie->name."</a>";
}