Advertisement
Guest User

Untitled

a guest
Jul 28th, 2015
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php foreach ($terms as $term) {echo '<a href="'.get_term_link($term->slug, 'sitecat').'">'.$term->name.'</a>,';} ?> >> <a href="<?php the_permalink(); ?>"><?php the_title('', ''); ?></a></h2></span>
  2.  
  3. $terms = get_the_terms( $post->ID, 'mytaxonomy' );
  4.  
  5. $term = array_pop($terms);
  6.  
  7. echo '<a href="'.get_term_link($term->slug, 'mytaxonomy').'">'.$term->name.'</a>,'
  8.  
  9. $terms = get_the_terms( $post->ID , 'your_custom_taxonomy' );
  10. foreach( $terms as $term ) {
  11. print $term->name;
  12. break;
  13. unset($term);
  14. }
  15.  
  16. $terms = get_the_terms( $post->ID, 'sitecat' );
  17. $first_term = $terms[0];
  18.  
  19. echo $first_term->name;
  20.  
  21. $first_term = get_the_terms( $post->ID, 'TAXONOMY_NAME' )[0];
  22. var_dump( $first_term );
  23.  
  24. $first_term_name = get_the_terms( $post->ID, 'TAXONOMY_NAME' )[0]->name;
  25. var_dump( $first_term_name );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement