Ready to get started?Download WordPress


different author templates for different roles (6 posts)

  1. davidbishop
    Posted 3 years ago #

    Is there a way to have different author pages depending on the authors role. I.e. lets say a administrator has a certain author template, a editor has a different one, subscriber a different ones again, etc etc? Or just some sort of if statement within the same template displaying certain fields if the person that authors page belongs to is of a certain role display that field?

  2. davidbishop
    Posted 3 years ago #

    I found the following what I thought would do exact what I wanted but seems to do the exact opposite which I don't think it's supposed to! It shows contents by the role of whom ever is logged in and displays the logged in usernot the user on the authors page! I put this in fucntions then called it on the authors opage:

    [Code moderated as per the Forum Rules. Please use the pastebin]

  3. davidbishop
    Posted 3 years ago #

    Sorry, here's the code with pastebin


  4. keesiemeijer
    Posted 3 years ago #

  5. davidbishop
    Posted 3 years ago #

    hi keesiemeijer,

    thanks for the reply, but was wanting templates by user role rather then indivduly applying templates

  6. davidbishop
    Posted 3 years ago #

    [deleted] was being stupid, worked it out:

    <?php $var = get_the_author_meta('user_level');
    if ($var == 1) {
    ?> <b>Ranking:</b> <?php echo cp_module_ranks_getRank($authordata->ID); ?></br>
    <?php }?>

Topic Closed

This topic has been closed to new replies.

About this Topic