SHARE
TWEET

WP Author Short Code

a guest Sep 26th, 2010 264 Never
  1. /* Start Get Author Link */
  2. function my_authors_meta($atts){
  3.         /* If the user passed an integer then good to go */
  4.         if (is_numeric($atts[0])) {
  5.                 $authorid = $atts[0];
  6.                 echo '<a href="';
  7.                 echo get_bloginfo('url');
  8.                 echo '/author/';
  9.                 echo the_author_meta('user_nicename', $authorid );
  10.                 echo '/">';
  11.                 echo the_author_meta('display_name', $authorid );
  12.         echo '</a>';
  13.         }
  14. }
  15. add_shortcode('author', 'my_authors_meta');
  16. add_filter('my_authors_meta', 'do_shortcode');
  17. /* Start Get Author Link call [author id] */
RAW Paste Data
Top