function fp_get_tax_values($postid, $tmp_sep = " | ") { $tax_list = array_merge(array("category", "post_tag"), fp_array_remove_blanks(fp_default_tax_list())); $post_terms = wp_get_post_terms($postid, $tax_list, array("fields" => "all")); $tmp_output = ""; foreach ($tax_list as $key => $tax_slug) { $term_list = array(); foreach ($post_terms as $term) { if ($term->taxonomy == $tax_slug) { $term_link = get_term_link($term); if (!is_wp_error($term_link)) { $term_list[$term->slug] = '<a href="' . esc_url($term_link) . '">' . $term->name . '</a>'; } } } if (count($term_list) > 0) { $tmp_output .= $tmp_sep . fp_get_tax_label($tax_slug) . ": "; $tmp_output .= implode(", ", $term_list); } } // foreach tax names return $tmp_output; }
function fp_get_tax_values($postid) { $tax_list = array_merge(array("category", "post_tag"), fp_default_tax_list()); $tmp_output = ""; foreach ($tax_list as $tmp_tax) { $tax_values = wp_get_post_terms($postid, $tmp_tax, array("fields" => "names")); if (count($tax_values) > 0) { //$tmp_output .= '<div class="frontier-post-tax-label" id="frontier-post-tax-label-'.$tmp_tax.'">'; //$tmp_output .= '<div class="frontier-post-tax-list" id="frontier-post-tax-list-'.$tmp_tax.'">'; $tmp_output .= fp_get_tax_label($tmp_tax) . ": "; } $tmp_output .= implode(", ", $tax_values) . " | "; } //echo $tmp_tax." ---> ".print_r($tax_values, true)."<br>"; return $tmp_output; }