WordPress - wp_list_authors для извлечения нескольких авторов Gravatar и Bio - PullRequest
1 голос
/ 25 октября 2009

Я вел блог WordPress с несколькими пользователями. Я создал шаблон authorlist.php, чтобы показать весь список авторов на странице.

Мой код шаблона

<?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(); ?>

Я использовал wp_list_authors, поэтому нет возможности показывать граватару и биографию каждого пользователя. Я хочу показать это. Есть ли шанс выручить меня? Благодарю. Извините за мой плохой английский.

С уважением,

Ответы [ 3 ]

4 голосов
/ 07 мая 2010

Немного опоздал, и у вас нет решения по собственной инициативе, но кто-то еще с этими вопросами может захотеть проверить плагин Author Avatars для этой функции.

0 голосов
/ 09 ноября 2009

Извините, я не могу пройти через это, поэтому только что опубликовал весь мой шаблон.

<?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>
0 голосов
/ 26 октября 2009

Эй, приятель, проверь ссылку ниже, я использовал этот метод, и теперь у меня есть список авторов с граватарами, био и отдельными ссылками на страницу каждого автора и профиль автора.

Плагины и хаки для форумов WordPress MU - Список авторов

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...