2015-09-27 69 views
0

作者我想在像下面合着者加WordPress的插件 - 列出所有同一職位

通過李四,屬多伊和Penny

在後面的前端顯示多個作者的名字我可以爲同一篇文章添加許多用戶。但在前端,只有帖子中的第一位作者顯示了byline和bio。我正在使用Twenty Thirteen主題,以及如何在前端顯示後端添加的所有用戶?

這是我的single.php文件

get_header(); ?> 

<div id="primary" class="content-area"> 
    <div id="content" class="site-content" role="main"> 

     <?php /* The loop */ ?> 
     <?php while (have_posts()) : the_post(); ?> 
      <?php get_template_part('content', get_post_format()); ?> 
      <?php twentythirteen_post_nav(); ?> 
      <?php comments_template(); ?> 

     <?php endwhile; ?> 

    </div><!-- #content --> 
</div><!-- #primary --> 

<?php get_sidebar(); ?> 
<?php get_footer(); ?> 
+0

我嘗試從https://wordpress.org/support/topic/problem-with-coauthors?replies=13 獲得幫助,但我無法做到這一點。 –

+0

你能更具體地說明爲什麼你不能這樣做嗎? –

+0

在single.php文件中沒有像 <?php the_author(); ?>。 那就是爲什麼我無法做到 –

回答

0

Incorporate Co-Authors Plus template tags into your theme

其他解決方案:

爲了添加添加合着者八方支援,你必須擁有的編輯權限主題模板。爲了在前臺顯示多個作者的信息,您需要將必要的Co-Authors Plus模板標籤添加到您的single.php和其他主題文件中。

專門爲副業,你要替換它說是這樣的:

<?php the_author(); ?> 

像這樣的東西:

<?php if (function_exists('coauthors')) { coauthors(); } else { the_author(); } ?> 

說具體片斷將讓你的主題正常降級當共同作者Plus未激活時。

,以顯示與自己的崗位上鍊接的作者,你要使用這樣的:

<?php if (function_exists('coauthors_posts_links')) { coauthors_posts_links(); } else { the_author_posts_link(); } ?> 

您可以使用下面的代碼的BIOS

<?php $coauthors = get_coauthors(); ?> 
<?php foreach($coauthors as $coauthor): ?> 
<center><div class="authbio"> 
<img src="<?php bloginfo('template_url'); ?>/images/<?php echo $coauthor->user_firstname; ?>.jpg" alt="" class="alignleft"/> 
<?php $userdata = get_userdata($coauthor->ID); ?> 
<?php if ($userdata->user_description) echo $userdata->user_description; ?> 
</div></center> 
<?php endforeach; ?> 

Reference

+0

我不擅長php.theme-> edit-> single.php文件沒有像<?php the_author(); ?> line.can你能幫我嗎? –

+0

在這種情況下,你只需添加<?php if(function_exists('coauthors')){coauthors(); } else {the_author(); }?> –

+0

我將我的single.php文件添加到問題中。我添加<?php if(function_exists('coauthors')){coauthors(); } else {the_author(); <?php get_template_part('content',get_post_format());}? ?>。但是不工作。只顯示第一個用戶。 –

相關問題