previous_post_link

Sponsored Link

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

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

Sponsored Link

原文(翻訳元)Used on single post permalink pages, this template tag displays a link to the previous post which exists in chronological order from the current post.

This tag must be used in The Loop.

引数

<?php previous_post_link($format, $link, $in_same_cat = false, $excluded_categories = ''); ?>

デフォルトの使い方

前の記事(時系列ポスト日付順)の記事タイトルが続く左角度引用(≪)とリンクが表示されす。デフォルトでは、このタグはprevious_post()のように動作します。

原文(翻訳元)Displays link with left angular quote (≪) followed by the post title of the previous post (chronological post date order). By default, this tag works like previous_post().

≪ Previous Post Title

<?php previous_post_link(); ?>

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

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

原文(翻訳元)Displays link with previous chronological post’s title wrapped in ‘strong’ tags (typically sets text to bold).

Previous Post Title

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

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

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

原文(翻訳元)Displays custom text as link to the previous post within the same category as the current post. Post title is not included here. “Previous in category” is the custom text, which can be changed to fit your requirements.

Previous in category

<?php previous_post_link('%link', 'Previous in category', TRUE); ?> 

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

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

原文(翻訳元)Displays link to previous 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.

Previous in category

<?php previous_post_link('%link', 'Previous in category', TRUE, '13'); ?> 

previous_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 previous post’s title (‘%title’).

in_same_cat

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

原文(翻訳元)(boolean) Indicates whether previous 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 previous post should not be listed. Separate multiple categories with and; example: ‘1 and 5 and 15’. There is no default.

備考

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

See also: next_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