next_post_link

Sponsored Link

シングル記事のパーマリンクのページに使われ、このテンプレートタグは、現在のページから時系列順に存在している次の投稿へのリンクを表示します。

このタグはループ内で使用しなければなりません。

Sponsored Link

Used on single post permalink pages, this template tag displays a link to the next post which exists in chronological order from the current post.

This tag must be used in The Loop.

next_post_linkのテンプレートタグ使用方法

<?php next_post_link('format', 'link', 'in_same_cat', 'excluded_categories'); ?> 

デフォルトの使い方

リンクを右角引用符(≫)が続く、次の記事(時系列ポスト日付順)への投稿タイトルをリンクで表示します。デフォルトでは、このタグはnext_post()のように動作します。

Displays link with the post title of the next post (chronological post date order), followed by a right angular quote (≫). By default, this tag works like next_post()

Next Post Title ≫

<?php next_post_link(); ?> 

リンクを太字投稿タイトルで表示する方法

‘strong’タグで囲った次の年代記事タイトルをリンクで表示します(通常はテキストを太字に設定します)。

Displays link with next chronological post’s title wrapped in ‘strong’ tags (typically sets text to bold).

Next Post Title

<?php next_post_link('<strong>%link</strong>'); ?> 

記事タイトルがなければ同カテゴリー内でリンクとしてテキストにします。

現在の記事と同カテゴリー内の次の記事へのリンクとして、カスタムテキストを表示します。記事のタイトルはここに含まれていません。”カテゴリー内の次へ投稿”は、お客様の要件に合わせて変更することができるカスタムテキストです。

Displays custom text as link to the next post within the same category as the current post. Post title is not included here. “Next post in category” is the custom text, which can be changed to fit your requirements.

Next post in category

<?php next_post_link('%link', 'Next post in category', TRUE); ?> 

同じカテゴリー内に、1つを除く方法

カテゴリー13(カテゴリー ID #)ではない限り、同じカテゴリー内の次のポストへのリンクを表示します。あなたは除外する任意のカテゴリーの番号を変更することができます。 区切り文字として” と “を使用して複数のカテゴリーを除外します。

Displays link to next post in the same category, as long as it is not in category 13 (the category ID #). You can change the number to any category you wish to exclude. Exclude multiple categories by using ” and ” as a delimiter.

Next post in category

<?php next_post_link('%link', 'Next post in category', TRUE, '13'); ?> 

next_post_linkのパラメーター

format

(string)リンクの文字列の書式です。これはどこにリンクの前後に来るかについてを制御します。文字列内の’%link’は、’link’のように宣言されて置き換えられます(次のパラメータを参照してください)。’Go to %link’は、ここに最終的な結果のスタイルをHTMLタグで入れて”Go to

(string) Format string for the link. This is where to control what comes before and after the link. ‘%link’ in string will be replaced with whatever is declared as ‘link’ (see next parameter). ‘Go to %link’ will generate “Go to

link

(string)リンクテキストが表示されます。デフォルトは次の記事のタイトルです(‘%title’)。

(string) Link text to display. Defaults to next post’s title (‘%title’).

in_same_cat

(boolean)次の記事が、現在の記事として同カテゴリー内でなければならないかどうかを表示します。TRUEに設定されている場合、現在のカテゴリーからの記事のみ表示されるでしょう。オプションです:

(boolean) Indicates whether next post must be within the same category as the current post. If set to TRUE, only posts from the current category will be displayed. Options are:

  • TRUE
  • FALSE (Default)

excluded_categories

(string)数値カテゴリーID(s)から次のポストがリストアップされないようにします。複数のカテゴリーで区切ります。;例:’1 and 5 and 15’。デフォルトはありません。
WordPressの2.2(のみ)、明らかには、カンマではなく、除外のために複数のカテゴリーをコンマにして連結します。例:’1, 5, 15’。まだデフォルト。

(string) Numeric category ID(s) from which the next post should not be listed. Separate multiple categories with and; example: ‘1 and 5 and 15’. There is no default.
In WordPress 2.2 (only), apparently, concatenating multiple categories for exclusion is done with a comma, not and; example: ‘1, 5, 15’. Still no default.

備考

previous_post_link()を参照してください。

See also previous_post_link().

リソース

関連テンプレートタグ

the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, wp_link_pages, next_post_link, next_posts_link, previous_post_link, previous_posts_link, posts_nav_link, sticky_class, the_meta

Sponsored Link