- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
「テンプレートタグ/get author posts url」の版間の差分
提供: WordPress Codex 日本語版
< テンプレートタグ
(en:Function Reference/get_author_posts_url 13:55, 7 December 2013 Mistercat 版を和訳。) |
(訳語を修正; 投稿者 ⇒ 作成者) |
||
3行目: | 3行目: | ||
</div> | </div> | ||
− | + | 投稿の作成者を ID で指定して、作成者アーカイブページの URL を取得します。 | |
<div id="Usage"> | <div id="Usage"> | ||
15行目: | 15行目: | ||
</div> | </div> | ||
− | {{Parameter|$author_id|整数|URL | + | {{Parameter|$author_id|整数|URL を取得する作成者の ID}} |
{{Parameter|$author_nicename|文字列|ユーザーのスラッグ。|オプション|空文字列}} | {{Parameter|$author_nicename|文字列|ユーザーのスラッグ。|オプション|空文字列}} | ||
22行目: | 22行目: | ||
</div> | </div> | ||
− | ; (文字列) : | + | ; (文字列) : 作成者アーカイブページの URL |
<div id="Examples"> | <div id="Examples"> | ||
28行目: | 28行目: | ||
</div> | </div> | ||
− | + | 現在の投稿の作成者について、作成者アーカイブページのリンクを表示します。 | |
<pre> | <pre> |
2014年9月8日 (月) 00:39時点における版
投稿の作成者を ID で指定して、作成者アーカイブページの URL を取得します。
使い方
<?php get_author_posts_url( $author_id, $author_nicename ); ?>
パラメータ
- $author_id
- (整数) (必須) URL を取得する作成者の ID
- 初期値: なし
- $author_nicename
- (文字列) (オプション) ユーザーのスラッグ。
- 初期値: 空文字列
戻り値
- (文字列)
- 作成者アーカイブページの URL
用例
現在の投稿の作成者について、作成者アーカイブページのリンクを表示します。
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author_meta( 'display_name' ); ?></a>
参考
URL を返す前に 'author_link' フィルターを適用します。
更新履歴
バージョン 2.1.0 にて導入されました。
ソースファイル
get_author_posts_url() は wp-includes/author-template.php
にあります。
関連資料
作成者タグ:
the_author(),
get_the_author(),
the_author_link(),
get_the_author_link(),
the_author_meta(),
get_the_author_meta(),
the_author_posts(),
get_the_author_posts(),
the_author_posts_link(),
get_author_posts_url(),
get_the_modified_author(),
the_modified_author(),
wp_dropdown_users(),
wp_list_authors()
関数リファレンス、テンプレートタグ目次もご覧ください。
最新英語版: WordPress Codex » Function_Reference/get_author_posts_url (最新版との差分)