• Resolved achaplin

    (@achaplin)


    Is it possible to exclude users from an author page? Below is the code for the page:

    <?php
    
    // Template Name: Authors List
    
    get_header(); ?>
    <style type='text/css'>
    .author {  }
    .author h3 { margin-bottom: 10px; }
    .author .description { overflow: hidden; }
    .author .description p { margin: 0; }
    .author .avatar { }
    .author h4 { font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
    	font-size: 21px;
    	color: #145A84;
    	text-align: left;
    	margin: 0px;
    	padding: 0px;
    	line-height: 21px; }
    .author .connect { border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; list-style: none; margin: 0; padding: 0; width: 100%; overflow: hidden; padding: 10px 0px; }
    .author .connect li { float: left; margin-right: 20px; }
    </style>
    
    <div class="maincontent" id="maincontent">
    <div class="latestentries" id="latestentries">
    <div class="contentheader" id="contentheader">
    <div class="colorblock" id="colorblock"></div>
    <span class="typepadding">CONTRIBUTORS</span></div>
    
    <div class="entry" id="entry">
    <?php
    
    		$authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts);
    		if($authors):
    		foreach($authors as $author):
    
    	?>
    
    <div class='author' id='author-<?php the_author_meta('user_login', $author->post_author); ?>'>
    
    <div class="posticonbox" id="posticonbox"><?php echo get_avatar(get_the_author_meta('user_email', $author->post_author), 50); ?></div>
    
    <div class="post" id="post">
    <h4><?php the_author_meta('display_name', $author->post_author); ?></h4>
    <?php if(get_the_author_meta('description', $author->post_author)): ?>
    
    <div class='description'>
    <p><?php the_author_meta('description', $author->post_author); ?></p>
    </div>
    
    <?php endif; ?>
    
      <?php
    
    			$recentPost = new WP_Query('author='.$author->post_author.'&showposts=1');
    			while($recentPost->have_posts()): $recentPost->the_post();
    			?>
    <br />
    <ul>
    <li>Recent Post: <a href='<?php the_title();?>'><?php the_title(); ?></a></h4></li>
    <li">view all posts by <?php the_author_posts_link(); ?></li>
    </ul>
    
    <p></p>
     <?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('digg', $author->post_author) || get_the_author_meta('flickr', $author->post_author)): ?>
    
    <ul class='connect'>
    <?php if(get_the_author_meta('twitter', $author->post_author)): ?>
    <li class="ulstyle"><a href='https://twitter.com/<?php the_author_meta('twitter', $author->post_author); ?>'>Twitter</a></li>
    <?php endif; ?>
    
    <?php if(get_the_author_meta('facebook', $author->post_author)): ?>
    <li class="ulstyle"v><a href='https://www.facebook.com/<?php the_author_meta('facebook', $author->post_author); ?>'>Facebook</a></li>
    <?php endif; ?>
    
    <?php if(get_the_author_meta('linkedin', $author->post_author)): ?>
    <li class="ulstyle"><a href='https://www.linkedin.com/in/<?php the_author_meta('linkedin', $author->post_author); ?>'>LinkedIn</a></li>
    <?php endif; ?>
    
    <?php if(get_the_author_meta('digg', $author->post_author)): ?>
    <li class="ulstyle"><a href='https://digg.com/users/<?php the_author_meta('digg', $author->post_author); ?>'>Digg</a></li>
    <?php endif; ?>
    
    <?php if(get_the_author_meta('flickr', $author->post_author)): ?>
    <li class="ulstyle"><a href='https://www.flickr.com/photos/<?php the_author_meta('flickr', $author->post_author); ?>/'>Flickr</a></li>
    <?php endif; ?>
    </ul>
    
    <?php endif; ?>
    <div class="border" id="border"></div>
    
    </div>
    
    <?php endforeach; endif; ?>
    
    </div>
    </div>
    </div><!--end post-->
    <div>
    </div>
    </div></div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
  • The topic ‘Excluding users on author list page’ is closed to new replies.