NULL, 'username' => NULL, 'email' => NULL, 'avatar' => NULL, 'avatar_size' => 96, 'name' => NULL, 'name_container' => 'h3', 'name_class' => 'name', 'name_pre' => '', 'name_post' => '', 'name_link' => NULL, 'container_element' => 'div', 'container_class' => 'author_bio_shortcode', 'avatar_container_element' => 'div', 'avatar_container_class' => 'avatar', 'bio_container_element' => 'div', 'bio_container_class' => 'bio', 'bio_paragraph' => true ), $atts)); // Make sure that, if set, the ID is an integer $id = (isset($id)) ? (int) $id : false; // Let's see if we want the current author, or someone else if (!empty($id) && is_int($id)){ // We're going on ID $the_author_id = $id; } else if (!empty($username)){ // We're going on username $the_author_id = get_user_by('login', $username); if ( $the_author_id ) $the_author_id = $the_author_id->ID; } else if (!empty($email)){ // We're going on e-mail address $the_author_id = get_user_by('email', $email); if ( $the_author_id ) $the_author_id = $the_author_id->ID; } else { // Just use the author global $post; // So we can grab the author ID of the current post $the_author_id = $post->post_author; } // Make sure the ID is an integer $the_author_id = intval($the_author_id); // Shall we add the user's avatar as well? if (!empty($avatar)){ // Don't let avatar_size be higher than 512 $avatar_size = ($avatar_size > 512) ? 512 : $avatar_size; $img = '<'.$avatar_container_element.' class="'.$avatar_container_class.'">'; $img .= get_avatar($the_author_id, $avatar_size); $img .= ""; } // Construct the name bit if (!empty($name)){ $name1 = $name_pre.get_the_author_meta('display_name', $the_author_id).$name_post; $nameh = "<$name_container class=\"$name_class\">"; $nameh .= (empty($name_link)) ? $name1 : ''.$name1.''; $nameh .= ""; } // construct the bio text bit $bio = '<'.$bio_container_element.' class="'.$bio_container_class.'">'; $bio .= ($bio_paragraph) ? '

' : ''; $bio .= get_the_author_meta('description', $the_author_id); $bio .= ($bio_paragraph) ? '

' : ''; $bio .= ""; $all_aboard = '<'.$container_element.' class="'.$container_class.'">'; if (!empty($avatar)) $all_aboard .= $img; if (!empty($name)) $all_aboard .= $nameh; $all_aboard .= $bio; $all_aboard .= ""; return $all_aboard; } add_shortcode('author_bio', 'pj_abs_shortcode'); ?>