Здравейте, имам проблем със показването на главна категория в wordpress. В момента ми показва само child категорията...
Това е кода:
Така показвам категориите.
Благодаря!
Това е кода:
Код:
<?php
if(!empty($imic_property_site_address)):
echo '<strong class="title">'.$imic_property_site_address;
$imic_property_site_city=get_post_meta(get_the_ID(),'imic_property_site_city',true); if(!empty($imic_property_site_city)){ echo ', <em>'.$imic_property_site_city.'</em>'; }
echo '</strong>';
endif;
$property_city = 'Test';
$property_price = get_post_meta(get_the_ID(),'imic_property_price',true);
$property_area_location = wp_get_object_terms(get_the_ID(), 'city-type');
$sl = '';
$last ='';
$total_area_location = count($property_area_location);
$num = 1;
foreach($property_area_location as $sa) {
// $conc = ($num!=$total_area_location)?'->':'';
if ($sa->parent>0 OR count($property_area_location)==0){
$last = $sa->name;
}
$sl .= $sa->name.$conc; $num++;
}
//
$sl = $last;
if(!empty($property_city)) {
} ?>
Код:
<?php if(!empty($property_area_location)) { echo '<a class="accent-color" data-original-title="'.$sl.'" style="cursor:default; text-decoration:none;" href="javascript:void(0);"><span style="color:#D81C28;font-weight:bold;display:inline-block;">'.$sl.'</span></a>'; } ?>
Благодаря!