static function get_post_categories($post_id, $only_first_cat = false, $taxonomy = 'category', $margin_elem_start = '', $margin_elem_end = '', $delimiter = ', ', $a_class = '', $no_link = false){ $cat = ''; $categories = wp_get_post_terms($post_id, $taxonomy ); if (!empty($categories)) { $ind = 1; foreach ($categories as $category) { if($ind != count($categories) && !$only_first_cat){ $cat_delimiter = $delimiter; }else{ $cat_delimiter = ''; } if($no_link){ $cat .= $margin_elem_start . $category->name . $cat_delimiter . $margin_elem_end; }else{ $cat .= $margin_elem_start . '' . $category->name . $cat_delimiter . '' . $margin_elem_end; } if($only_first_cat){ break; } $ind ++; } //$cat = __('in','cosmotheme').' '. $cat; } return $cat .' ' ; }