Posted By

sdxxx on 12/03/10


Tagged

wordpress shortcode


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

sdxxx


WP Shortcode - retrieve author page url


 / Published in: PHP
 

URL: http://codex.wordpress.org/Shortcode_API

Using shortcode to retrieve the author page url (ex. abc.com/?author=123), using the WP Shortcode API as reference.

  1. //retrieve author page url (ex. http://www.abc.com/?author=123) by using shortcode [XXXXX id=123]
  2. function XXXXX_func($atts) {
  3. extract(shortcode_atts(array(
  4. "id" => '1'
  5. ), $atts));
  6. return get_author_posts_url($id);;
  7. }
  8. //add shortcode [XXXXX id=123]
  9. add_shortcode('XXXXX', 'XXXXX_func');

Report this snippet  

You need to login to post a comment.