This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

PeteNC3

By: a guest on Feb 18th, 2013  |  syntax: PHP  |  size: 0.64 KB  |  views: 149  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // get taxonomies terms links
  2. function custom_taxonomies_terms_links() {
  3.         global $post, $post_id;
  4.         // get post by post id
  5.         $post = &get_post($post->ID);
  6.         // get post type by post
  7.         $post_type = $post->post_type;
  8.         // get post type taxonomies
  9.         $taxonomies = get_object_taxonomies($post_type);
  10.         foreach ($taxonomies as $taxonomy) {
  11.                 // get the terms related to post
  12.                 $terms = get_the_terms( $post->ID, $taxonomy );
  13.                 if ( !empty( $terms ) ) {
  14.                         $out = array();
  15.                         foreach ( $terms as $term )
  16.                                 $out[] = '<a href="' .get_term_link($term->slug, $taxonomy) .'">'.$term->slug.'</a>';
  17.                         $return = join( ', ', $out );
  18.                 }
  19.         }
  20.         return $return;
  21. }
clone this paste RAW Paste Data