wordpress显示作者Twitter

时间:2014-02-13 15:45:03

标签: wordpress twitter

我想在单个页面上显示作者twitter,其中显示为“作者”。

以下是我目前使用的内容:

By <?php the_author_posts_link(); ?> (<?php if ( get_the_author_meta( 'twitter' ) ) : ?>
<a href="<?php the_author_meta('twitter' );?>" target="_blank">Follow On Twitter</a>
<?php endif; ?>) 

我只想更改“在Twitter上关注”一下,以显示用户@twitterusername,该链接可以转到twitter页面,只是希望它显示该用户名?

示例:worldinsport.com/froch-vs-groves-ii-agreed

问候

1 个答案:

答案 0 :(得分:0)

试试这个,您可以使用<?php the_author_meta('user_email'); ?>来获取Twitter用户ID

By <?php the_author_posts_link(); ?> (<?php if ( get_the_author_meta( 'twitter' ) ) : ?>
   <a href="<?php the_author_meta('twitter' );?>" target="_blank">
       Follow On Twitter  <?php the_author_meta('user_email'); ?>
  </a>
<?php endif; ?>) 

参考:http://codex.wordpress.org/Function_Reference/the_author_meta