Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_shortcode('author-name', 'author_name_shortcode_handler');
- function author_name_shortcode_handler($atts,$content=null){
- if (!is_single()) return;
- global $wp_query;
- $user_id = $wp_query->post->post_author;
- $name = get_user_meta($user_id, 'first_name', true) . ' ' . get_user_meta($user_id, 'last_name', true);
- if (!empty($name))
- return $name;
- else
- return;
- }
Add Comment
Please, Sign In to add comment