Support » Themes and Templates » contributor list and conditional

  • I’m on 2.7

    I want to create a list on my home page side bar of only my blog’s contributors, (not auhtor, editor, admin, etc.) ONLY users tagged as contributors.

    And, when a user is reading an article written by an author who IS a contributor I want to display a simple block of code.

    I looked through the template conditionals and tags but could not find specifics.

    Thans in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • I think you should install some plugins can query the users’ information then modify it with some if statements, and “role=contributor” 🙂

    Do you know of any such plugin? I have been looking but can’t find one…

    If you can find the Userlevel for contributor you could just you use IF / ELSE….

    Something like this should work…

    <?php global $user_ID; if( $user_ID ) : ?>
    <?php if( current_user_can('level_10') ) : ?>
    
    Do what you want here...
    
    <?php else : ?>
    <?php endif; ?>
    <?php endif; ?>

    Level 10 is admin, so you’ll just need to find out what a contributor is…

    Found that via google within a few moments, but should be able to adjust it to suit…. at least trim down on the PHP opening and closing…

    <?php
    global $user_ID; if( $user_ID ) :
    if( current_user_can('level_10') ) :
    ?>
    
    Your stuff here..
    
    <?php
    else :
    endif;
    endif;
    ?>

    Is how i’d personally do it, little easier for me to read…

    Looking at the roles and user-level codex page i’m not sure using user-level will work perfectly, you’ll just have to try and see…

    http://codex.wordpress.org/Roles_and_Capabilities#Contributor

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘contributor list and conditional’ is closed to new replies.