2017-01-23 65 views
0

我有帖子頁面與作者信息。但是,似乎作者的生物框應該只顯示內容已被輸入。如何檢查?顯示作者生物盒

<?php if(get_avatar(get_the_author_meta('ID')) != 0){ 
    echo get_avatar(get_the_author_meta('ID') , 80); 
}?> 
<div class="post-full-desc"> 
    <h6><?php the_author_posts_link(); ?></h6> 
    <p><?php echo get_the_author_meta('description')?></p> 
</div> 
+1

你的問題不清楚。 'the_author_posts_link()'不打印作者姓名?或'get_the_author_meta()'不工作? –

回答

0

如果你想檢查作者描述字段爲空或不空,如果不是空的,那麼你想顯示它?

<?php if(get_the_author_meta('description', $id) != ''):?> 
    <div class="post-full-desc"> 
     <h6><?php the_author_posts_link(); ?></h6> 
     <p><?php echo get_the_author_meta('description')?></p> 
    </div> 
<?php endif;?>