Short Code for Author Box always displays at top of post and incorrectly
-
Hey guys – I am working on a simple short code [authorbox] to display an author box when called at the bottom of the post. I don’t want this in all posts, just when I call the short code.
function my_author_box() { $author_name = the_author(); $site_link = the_author_meta('user_url'); $author_desc = the_author_meta('description'); $facebook_link = the_author_meta('aim'); $twitter_link = the_author_meta('yim'); $author_img_link = the_author_meta('jabber'); $return_text = '<div id="author-info"><div id="author-image"><a href="'.$site_link.'"><img src="'.$author_img_link.'" alt="'.$author_name.'" title="'.$author_name.'"/></a></div> <div id="author-bio"><h4>Written by '.$author_name.'</h4><p>'.$author_desc.'</p></div></div>'; return $return_text; } add_shortcode('authorbox', 'my_author_box'); ?>
*note – I’m using the jabber, aim, and yahoo im fields to store twitter, facebook, and a link to an image. They are all in “https://www.sitelink.com” format.
Few problems:
1. I get the basic meta info from listed at the very top of my posts, even though the [authorbox] code is placed at the very bottom. This will not display the CSS or image etc, just straight text with no spaces in between.2. I ALSO get the author info at the bottom which is formatted according to my CSS. Several of the data items do not display, even though they appear correct at the top of the post.
Any ideas? Desperately trying to get this to work.
- The topic ‘Short Code for Author Box always displays at top of post and incorrectly’ is closed to new replies.