Advertisement
Guest User

Link FPW title to selected taxonomy & term

a guest
Mar 19th, 2013
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. if ( !empty($title) ) {
  2.     // If there is a taxonomy set AND there is only one term selected for this widget...
  3.     if ( $taxonomy != 'none' && 1 == count( $term ) ) {
  4.         // output the widget title wrapped in a link to the single selected term.
  5.         echo $before_title . '<a href="' . get_term_link( $term[0], $taxonomy ) . '">' . $title . '</a>' . $after_title;
  6.     } else {
  7.         // Otherwise just show the title without a link.
  8.         echo $before_title . $title . $after_title;
  9.     }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement