• I need to exclude the admin or show on the authors of the site.
    Help?
    Here’s my code:

    <?php get_header(); ?>
    <div id="inside-content">
    
    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    <h2 id="inside-h2" class="chunk orange"><?php the_title(); ?></h2>
    <?php the_content(); ?>
    <?php endwhile; endif; ?>
    
    <div id="ap-content">
    <?php
    // Get the authors from the database ordered by user nicename
    global $wpdb;
    $query = "SELECT ID, user_nicename from $wpdb->users ORDER BY user_nicename";
    $author_ids = $wpdb->get_results($query);
    // Loop through each author
    foreach($author_ids as $author) :
    // Get user data
    $curauth = get_userdata($author->ID);
    // If user level is above 0 or login name is "admin", display profile
    if($curauth->user_level > 0 || $curauth->user_login == 'admin') :
    
    // Get link to author page
    $user_link = get_author_posts_url($curauth->ID);
    // Set default avatar (values = default, wavatar, identicon, monsterid)
    $avatar = 'wavatar';
    ?>
    	<div class="project">
        	<h3 class="project-title chunk"><a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>"><?php echo $curauth->display_name; ?></a></h3>
            <h4 class="orange chunk"><?php echo $curauth->subtitle; ?></h4>
            <a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>" target="_self"><?php echo  userphoto__get_userphoto($curauth->ID, 1, '', '', '', ''); ?></a>
    	</div>
    
    <?php endif; ?>
    <?php endforeach; ?>
    
    <div class="clear"></div></div><!-- end #ap-content -->
    
    <div class="clear"></div></div><!--- INSIDE-PAGE -->
    <div class="clear"></div></div><!-- CONTENT -->
    <div class="clear"></div></div><!-- MAIN -->
    <?php get_footer(); ?>

  • The topic ‘Exclude Admin from User Profile Pages’ is closed to new replies.