dsmvqp3124 2016-07-02 05:53
浏览 4
已采纳

Wordpress:如何在wordpress中获得自定义元?

For every blog post I need to show the custom meta guest_author, if that is not set then default user.

This is what I want to do in PHP, please help

If guest_author is available echo guest_author else echo author

  • 写回答

2条回答 默认 最新

  • douzhao6584 2016-07-03 09:15
    关注

    This is what I ultimately did:

    <span class="post-info-text"><?php echo 'This interview was taken by: </span> <span class="author-name vcard fn author" itemprop="name">'; ?>
    <?php $guest_author = get_post_meta(get_the_ID(), 'guest_author', true);
    if (!$guest_author){the_author_posts_link();}else{echo $guest_author;} ?></span>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?