Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function display_property_taxonomy_terms($post_id) {
- $property_terms = get_the_terms($post_id,'listing_type');
- if($property_terms){
- $kgs_primaryterm = get_post_meta(get_the_id(), '_yoast_wpseo_primary_listing_type', true);
- $kgs_allterms_array = array();
- $kgs_sortedterms_array = array();
- foreach($property_terms as $term) {
- $term_id = $term->term_id;
- $term_name = $term->name;
- $kgs_allterms_array[] = $term_name;
- if ($term_id == $kgs_primaryterm) {
- array_unshift($kgs_allterms_array, $term_name);
- }
- }
- $kgs_sortedterms_array = array_unique($kgs_allterms_array);
- foreach($kgs_sortedterms_array as $sortedterm) {
- echo ' <span>' . $sortedterm . '</span> ';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement