Support » Themes and Templates » Help with author page? Sidebar broken

  • Hi guys, I am using this author page on my WordPress site: Apparently it does not work so well with the MobileWorld theme… I was wondering if anyone could help me? The sidebar displays under the authors instead of, well, on the side.

    You can view my author page here:

    And this is the code for the page:

    <?php get_header(); ?>
    	<style type='text/css'>
    	.author {}
    	.author h3 {margin-bottom:2px;font-weight:bold}
    	.author h5 {font-size: 13px; font-style:italic;font-weight:normal}
    	/* .author .description {overflow:hidden} */
    	.author .description p {margin:0;padding-right:5px}
    	.author .avatar {float:right;clear:both;border:5px solid #f2f1f1}
    	.author h4 {background:#f2f1f1;padding:5px;margin:10px 0 0px 0;border:0px dotted #ccc;font-size: 12px}
    	.author .connect {border-top: 1px solid #ccc;border-bottom:1px solid #ccc;list-style:none;margin:0;padding:5px 0 0px 0;width:100%;overflow:hidden;margin-bottom:60px}
    	.author .connect li {float:left;margin-right:20px}
    <div class="span-24" id="contentwrap">
    	<div class="span-16">
    	<h2 class='pagetitle'>Steve's Team</h2>
    		<div id="content">	
    		$authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts);
    		foreach($authors as $author):
    		<a name="<?php the_author_meta('display_name', $author->post_author); ?>"></a>
    		<div class='author' id='author-<?php the_author_meta('user_login', $author->post_author); ?>'>
    			<h3><?php the_author_meta('display_name', $author->post_author); ?></h3>
    			<h5><?php the_author_meta('user_title', $author->post_author); ?></h5>
    			<?php echo get_avatar(get_the_author_meta('user_email', $author->post_author), 150); ?>
    			<?php if(get_the_author_meta('description', $author->post_author)): ?>
    			<div class='description'>
    				<p><?php the_author_meta('description', $author->post_author); ?></p>
    			<?php endif; ?>
    			$recentPost = new WP_Query('author='.$author->post_author.'&showposts=1');
    			while($recentPost->have_posts()): $recentPost->the_post();
    			<h4>Recent Post: <a href='<?php the_title();?>'><?php the_title(); ?></a></h4>
    			<?php endwhile; ?>
    			<?php if(get_the_author_meta('twitter', $author->post_author) || get_the_author_meta('facebook', $author->post_author) || get_the_author_meta('linkedin', $author->post_author) || get_the_author_meta('xbox', $author->post_author) || get_the_author_meta('psn', $author->post_author)): ?>
    			<ul class='connect'>
    				<?php if(get_the_author_meta('twitter', $author->post_author)): ?>
    				<li><a href='<?php the_author_meta('twitter', $author->post_author); ?>'><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/twitter.png" width="32" height="32" alt="Twitter" /></a></li>
    				<?php endif; ?>
    				<?php if(get_the_author_meta('facebook', $author->post_author)): ?>
    				<li><a href='<?php the_author_meta('facebook', $author->post_author); ?>'><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/facebook.png" width="32" height="32" alt="Facebook" /></a></li>
    				<?php endif; ?>
    				<?php if(get_the_author_meta('linkedin', $author->post_author)): ?>
    				<li><a href='<?php the_author_meta('linkedin', $author->post_author); ?>'><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/linkedin.png" width="32" height="32" alt="LinkedIn" /></a></li>
    				<?php endif; ?>
    				<?php if(get_the_author_meta('xbox', $author->post_author)): ?>
    				<li><a href='<?php the_author_meta('xbox', $author->post_author); ?>'><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/xbox.png" width="32" height="32" alt="Xbox Live" /></a></li>
    				<?php endif; ?>
    				<?php if(get_the_author_meta('psn', $author->post_author)): ?>
    				<li><a href='<?php the_author_meta('psn', $author->post_author); ?>/'><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/psn.png" width="32" height="32" alt="PSN" /></a></li>
    				<?php endif; ?>
    				<?php if(get_the_author_meta('steam', $author->post_author)): ?>
    				<li><a href='<?php the_author_meta('steam', $author->post_author); ?>/'><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/steam.png" width="32" height="32" alt="steam" /></a></li>
    				<?php endif; ?>
    			<?php endif; ?>
    		<?php endforeach; endif; ?>
    <?php get_sidebars(); ?>
    <?php get_footer(); ?>


Viewing 5 replies - 1 through 5 (of 5 total)
  • Looks like you haven’t closed the div with the class of author. Try adding another div in that nest of divs. I find it helpful to label my the ends of items with a comment block so I know exactly which one I’m looking at.

    </div><!-- /.author -->

    I actually tried adding and removing closing </div> tags so many times I lost track, haha. I did just add the missing one in but am still having the same problem.

    Well it’s in the HTML. When you browse the source with browser dev tools you can see that the sidebar is inside the .author which is nested inside the .author above it. That’s from a div that’s not closed properly.

    I’d strip all of the dynamic code and just put in ‘content’ ‘sidebar’ and get it displaying right then add the dynamic stuff back in.

    I’m sorry, I’m not super clear what you mean by this/what to do next. When I created the page I took the dynamic code from the original creator’s authors.php file and worked it into the MobileWorld theme’s page.php file. So basically if I strip the dynamic code I get the page.php file, which works fine.

    If it helps at all, this code was working fine when I had only 1 or 2 authors; the addition of the third author is what “broke” the sidebar. (You can see the working version here:

    I’m sorry to bump this, but I am looking to launch the site and would really like this page in there. Any other ideas? :\

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Help with author page? Sidebar broken’ is closed to new replies.