我正在与多个用户一起运行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, 因此没有显示每个用户的头像和传记的选项。我想展示一下。有机会帮我吗?谢谢。对不起, 我的英语不好。
带着敬意,
#1
有点晚了, 还没有解决方法, 但是其他有这个问题的人可能想看看Author Avatars插件来获得此功能。
#2
嗨, 队友, 请查看下面的链接, 我使用了这种方法, 现在有作者名单, 包括引人注目, 简历以及指向每个作者博客页面和作者个人资料的个人链接。
WordPress MU论坛插件和黑客-列表作者
#3
抱歉, 我无法正确处理, 因此刚刚发布了我的整个模板。
<?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>
评论前必须登录!
注册