LoginSignup
0
0

More than 3 years have passed since last update.

WordPress投稿者情報を取得するコード

Last updated at Posted at 2019-04-30

WordPressでユーザー情報を取得する場合のコードです。
記事投稿者の表示などに使えます。

投稿者名 を表示

php
<?php the_author_meta('display_name'); ?>//ブログ上の表示名
<?php the_author_meta('user_nicename'); ?> //ニックネーム

投稿者 プロフィール写真 を表示

php
<?php echo get_avatar( get_the_author_id(), 300 ); ?>

投稿者 プロフィール情報 を表示

php
<?php the_author_meta('user_description'); ?>

投稿者 メールアドレス を表示

php
<?php the_author_meta('user_email'); ?>

投稿者 サイトURL を表示

php
<?php the_author_meta('user_url'); ?>

表示確認コード

表示確認に使えるコードセットです。コピペでご使用ください。

<div class="p-author">
<figure class="p-author__figure"><?php echo get_avatar( get_the_author_id(), 300 ); ?></figure>
<div class="p-author__name"><?php the_author_meta('display_name'); ?></div>
<p class="p-author__description"><?php the_author_meta('user_description'); ?></p>
<div class="p-author__email"><?php the_author_meta('user_email'); ?></div>
<div class="p-author__email"><a href="<?php the_author_meta('user_url'); ?>" target="_blank"><?php the_author_meta('user_url'); ?></a></div>
</div>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0