Advertisement
srikat

Untitled

Feb 11th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. add_shortcode( 'post_tags', 'genesis_post_tags_shortcode' );
  2. /**
  3. * Produces the tag links list.
  4. *
  5. * Supported shortcode attributes are:
  6. * after (output after link, default is empty string),
  7. * before (output before link, default is 'Tagged With: '),
  8. * sep (separator string between tags, default is ', ').
  9. *
  10. * Output passes through 'genesis_post_tags_shortcode' filter before returning.
  11. *
  12. * @since 1.1.0
  13. *
  14. * @param array|string $atts Shortcode attributes. Empty string if no attributes.
  15. * @return string Shortcode output
  16. */
  17. function genesis_post_tags_shortcode( $atts ) {
  18.  
  19. $defaults = array(
  20. 'after' => '',
  21. 'before' => __( 'Tagged With: ', 'genesis' ),
  22. 'sep' => ', ',
  23. );
  24. $atts = shortcode_atts( $defaults, $atts, 'post_tags' );
  25.  
  26. $tags = get_the_tag_list( $atts['before'], trim( $atts['sep'] ) . ' ', $atts['after'] );
  27.  
  28. //* Do nothing if no tags
  29. if ( ! $tags )
  30. return;
  31.  
  32. if ( genesis_html5() )
  33. $output = sprintf( '<span %s>', genesis_attr( 'entry-tags' ) ) . $tags . '</span>';
  34. else
  35. $output = '<span class="tags">' . $tags . '</span>';
  36.  
  37. return apply_filters( 'genesis_post_tags_shortcode', $output, $atts );
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement