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条)

报告相同问题?

悬赏问题

  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签)
  • ¥50 sft下载大文阻塞卡死
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失