2009-10-25 4 views
1

Je dirigeais le blog WordPress avec plusieurs utilisateurs. J'ai créé le modèle authorlist.php pour afficher toute la liste des auteurs dans la page.WordPress - wp_list_authors pour récupérer gravatar auteur multiples et bio

Mon code de modèle est

<?php 
/* 
Template Name: Author List 
*/ 
?> 


<?php get_header(); ?> 

<div id="main"> 
    <div id="pageleft"> 

<?php if (have_posts()) : ?> 
<?php while (have_posts()) : the_post(); ?> 

<div class="main-page-container"> 
    <div class="page-top"></div> 
    <div class="page-container"> 
      <div class="authors-list"> 
       <h1><?php the_title(); ?></h1> 
<?php wp_list_authors('optioncount=1'); ?> 
      </div> 
      <div class="clear"> 
      </div> 
     </div> 
    <div class="page-bottom"> 
    </div> 


<?php endwhile; ?> 

<?php else : ?> 

<h2 class="center">Not Found</h2> 
<p class="center">Sorry, but you are looking for something that isn't here.</p> 

<?php endif; ?> 

<!--/index--> 
<br /> 
<?php get_footer(); ?> 

je wp_list_authors, donc il n'y a pas d'option pour afficher gravatar et biographie de chaque utilisateur. Je veux le montrer. Une chance de m'aider? Merci. Désolé pour mon mauvais anglais.

Avec Cordialement,

Répondre

0

Hé compagnon, consultez le lien ci-dessous, j'ai utilisé cette méthode et ont maintenant une liste d'auteurs avec gravatars, bio et des liens individuels à chacun des auteurs blogpage et le profil de l'auteur.

WordPress MU Forums Plugins and Hacks - List Authors

+0

hey ron, est-ce que ça marche sur wordpress? Coz je cours wordpress pas wordpress mu. L'as tu essayé ? Quel code? Je vois ce sujet et confus: S. Merci de m'avoir aidé – spotlightsnap

0

Désolé, je ne peux pas aller à travers elle ont donc juste de publier l'ensemble de mon modèle.

<?php 
/* 
Template Name: standard 
*/ 

get_header(); ?> 
<!-- This sets the $curauth variable --> 

    <?php 
    if(isset($_GET['author_name'])) : 
     $curauth = get_userdatabylogin($author_name); 
    else : 
     $curauth = get_userdata(intval($author)); 
    endif; 

    $curID = $curauth->ID; 




    ?> 
<div id="toolbarWrap"> 
    <div id="toolbarContainer" class="container_12"> 

     <div id="pageTitle" class="grid_12"> 
      <div id="roundedH1">     
       <b class="b1f"></b><b class="b2f"></b><b class="b3f"></b><b class="b4f"></b> 

       <div class="contentf"> 
       <div><h1>Staff Profile</h1></div> 
       </div> 

       <b class="b4f"></b><b class="b3f"></b><b class="b2f"></b><b class="b1f"></b> 
      </div> 
     </div><!-- /pageTitle --> 


     <div class="clear"></div> 

     <div id="tabRowWrap" class="grid_12"> 

        <?php include(TEMPLATEPATH . '/modules/breadcrumb.php'); ?> 

     </div><!-- /tabRowWrap --> 
    </div><!--/toolbarContainer --> 

</div><!-- /toolbarWrap --> 

<div id="mainContent" class="container_12"> 
    <div class="padTop"> 

    <div id="leftColumn" class="grid_9"> 

    <div id="panes"> 

     <div id="post"> 

      <div class="tabContent"> 
      <div class="author-profile vcard"> 
      <div class="grid_2 alpha"> 
       <?php echo get_avatar($curauth->user_email, '120', $avatar); ?> 


     <?php 


     $fullname = get_the_author_meta('first_name',$curID) + ' ' + get_the_author_meta('last_name',$curID); 
     $firstname = get_the_author_meta('first_name',$curID); 
     $nickname = get_the_author_meta('nickname',$curID); 
     $position = get_the_author_meta('position',$curID); 
     $hobbies = get_the_author_meta('hobbies',$curID); 
     $interests = get_the_author_meta('interests',$curID); 
     $modals = get_the_author_meta('modals',$curID); 
     $bio = get_the_author_meta('description',$curID); 

     $favfood = get_the_author_meta('favfood',$curID); 
     $song = get_the_author_meta('song',$curID); 
     $flower = get_the_author_meta('flower',$curID); 
     $pet = get_the_author_meta('pet',$curID); 
     $drink = get_the_author_meta('drink',$curID); 
     $favitem = get_the_author_meta('favitem',$curID); 
     $favsnack = get_the_author_meta('favsnack',$curID); 
     $favmovie = get_the_author_meta('favmovie',$curID); 
     $favactor = get_the_author_meta('favactor',$curID); 
     $motherquote = get_the_author_meta('motherquote',$curID); 

     ?> 

      </div> 

      <div class="grid_7 omega"> 
       <!-- Name and links --> 
       <div class="tabTitle"> 
        <h2><?php echo $curauth->first_name; ?> <?php echo $curauth->last_name; ?></h2><br /> 
        <h3><?php the_author_meta('position',$curID); ?></h3> 
       </div> 
       <td><p class="authorLinks"><a href="<?php bloginfo('url'); ?>/therapist-blogs/<?php echo $curauth->first_name; ?>-<?php echo $curauth->last_name; ?>">Blog</a> - <a href="mailto:<?php echo $curauth->user_email; ?>">Email</a></p> 
       <div class="clear"></div> 
       <br /> 

       <!-- Description --> 
       <?php if ($description) { ?> 
        <tr> 
       <th><h4>Bio:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $description; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

       <!-- Interests --> 
       <?php if ($interests) { ?> 
        <tr> 
       <th><h4>Interests:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $interests; ?> 

         </tr> 
       </p></td> 
       <?php }; ?> 

       <!-- Modals --> 
       <?php if ($modals) { ?> 
        <tr> 
       <th><h4>Modalities:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $modals; ?> 

        </tr> 
       </p></td> 
       <?php }; ?> 

       <!-- Hobbies --> 
       <?php if ($hobbies) { ?> 
        <tr> 
       <th><h4>Hobbies:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $hobbies; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

      <h3>60 Seconds with <?php echo $nickname; ?></h3> 


      <table class="quickProfile-Table"> 

       <!-- favfood --> 
       <?php if ($favfood) { ?> 
        <tr> 
       <th><h4>Favourite Food:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $favfood; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

       <!-- song --> 
       <?php if ($song) { ?> 
        <tr> 
       <th><h4>Favourite Song:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $song; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

       <!-- flower --> 
       <?php if ($flower) { ?> 
        <tr> 
       <th><h4>Favourite Flower:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $flower; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

       <!-- pet --> 
       <?php if ($pet) { ?> 
        <tr> 
       <th><h4>Favourite Pet:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $pet; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

       <!-- drink --> 
       <?php if ($drink) { ?> 
        <tr> 
       <th><h4>Favourite Drink:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $drink; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

       <!-- favitem --> 
       <?php if ($favsnack) { ?> 
        <tr> 
       <th><h4>Favourite Snack:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $favsnack; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

       <!-- favmovie --> 
       <?php if ($favmovie) { ?> 
        <tr> 
       <th><h4>Favourite Movie:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $favmovie; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

       <!-- favactor --> 
       <?php if ($favactor) { ?> 
        <tr> 
       <th><h4>Favourite Actor:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $favactor; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

       <!-- favitem --> 
       <?php if ($favitem) { ?> 

       <th><h4>Favourite thing to spend money on:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $favitem; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

       <!-- motherquote --> 
       <?php if ($motherquote) { ?> 
        <tr> 
       <th><h4>Something your mother always said:</h4></th> 
       <td><p class="author-description author-bio">      

        <?php echo $motherquote; ?> 

       </p></td> 
        </tr> 
       <?php }; ?> 

      </table> 


       <!-- Posts --> 

       <h3>Posts by <?php echo $curauth->nickname; ?>:</h3> 
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?> 

       <ul> 
        <li> 
         <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"> 
         <?php the_title(); ?></a>, 
         <?php the_time('d M Y'); ?> in <?php the_category('&');?> 
        </li> 
       </ul> 

       <?php endwhile; else: ?> 
       <h3><?php _e('Sorry, no posts matched your criteria.'); ?></h3> 
       <?php endif; ?> 

      </div><!-- end grid_7 -->  
      </div><!-- end author-profile vcard --> 
      </div> 


     </div><!-- /post --> 
      <hr /> 



    </div><!-- /panes --> 

    <div class="clear"></div> 


    </div><!-- /leftcolumn--> 



<?php get_sidebar(); ?> 



</div><!-- /Padtop --> 
    <div class="clear"></div> 
</div><!--/mainContent--> 

    <div class="clear"></div> 
<div id="footer"> 

    <div id="footerToolbar"> 

    </div><!-- /footerToolbar --> 

    <div id="footerMain"> 

    </div><!-- /footerMain --> 


</div><!--/footer--> 

</div><!-- /page-container --> 
<div id="lowerSpacer"> 
<div class="loveLink"><a href="http://www.publikdesign.com" target="_blank" title="Website and graphic design on Phillip Island">Website designed and developed by Publik Design</a></div> 
</div> 
<div id="contactOverlay" class="simple_overlay"> 
    <div class="overlayContent"> 
     <div class="overlayHeaderBG"> 
      <div class="overlayHeader"> 
      <h3>Contact Us</h3> 
      </div><!-- /overlayHeader --> 
     </div><!-- /overlayHeaderBG --> 

     <div class="overlayBody"> 
     <p>Please take the time to fill out this form and we will get back to you as soon as possible.</p> 

     <div id="webform"> 
     <form> 

      <label for="user">Name</label> 

      <input type="text" name="user" value=""><br /> 

      <label for="emailaddress">Email Address:</label> 
      <input type="text" name="emailaddress" value="" /><br /> 

      <label for="comments">Comments:</label> 
      <textarea name="comments"></textarea><br /> 

      <label for="terms">Agree to Terms?</label> 
      <input type="checkbox" name="terms" class="boxes" /><br /> 

      <input type="submit" name="submitbutton" id="submitbutton" value="Submit" /> 

     </form> 
     </div> 

     </div><!-- /overlayBody --> 

    </div><!-- /overlayContent --> 
</div><!--/contactOverlay --> 

</body> 
</html> 
4

Un peu en retard et n'ont pas une solution à rouler propre, mais quelqu'un d'autre avec cette question peut vouloir vérifier le plugin Author Avatars pour cette fonctionnalité.

Questions connexes