get_year_link

Sponsored Link

PHPでの使用のために特定の年まで年一度のアーカイブURLを返します。
それはURLを表示しません。
年が決められるなら、「タグは本年度のアーカイブのためにURLを返します」。

Sponsored Link

Returns the yearly archive URL to a specific year for use in PHP. It does NOT display the URL. If year is set to , the tag returns the URL for the current year’s archive.

タグ使用方法

<p><?php get_year_link('year'); ?></p>

Year as Link

リンクとしてアンカータグにPHPエコーコマンドを使用することによってそれを表示して、本年度のアーカイブのためにURLを返します。

Returns the URL for the current year’s archive, displaying it as a link in the anchor tag by using the PHP echo command.

<p><a href="<?php echo get_year_link(<i>); ?>">Posts from this year</a></i></p>

Year as a variable

それを可変$year03に割り当てて、そのアーカイブ2003年にURLを返します。 そして、1ページのほかの場所で変数を使用することができます。

Returns URL for the archive year 2003, assigning it to the variable $year03. The variable can then be used elsewhere in a page.

<p><?php $year03 = get_year_link(2003); ?></p>

Using With PHP Variables

PHPは使用のためにLoopの中でブロックをコード化します: 年から可変$アーク_年を割り当てます。 これが使用される、_年_リンク()タグを手に入れてください、PHPエコーコマンドと共にアンカータグの中にそれを表示して。(タグはポストのための年一度のアーカイブへのリンクとしてURLを返します)。 中で中古の書式の記号列に関するインフォメーションのためのFormatting DateとTimeが__時間()タグを手に入れるのを見てください。

PHP code block for use within The Loop: Assigns year to the variable $arc_year. This is used with the get_year_link() tag, which returns the URL as a link to the yearly archive for a post, displaying it within an anchor tag with the PHP echo command. See Formatting Date and Time for info on format strings used in get_the_time() tag.

<p><?php
  $arc_year = get_the_time('Y');
  ?>
  <a href="<?php echo get_year_link($arc_year); ?>"><?php the_time('Y') ?> archive</a> </p>

year

(integer) The year for the archive. Use to assign current year.

関連テンプレートタグ

edit_post_link, edit_comment_link,
link_pages
, wp_link_pages, get_year_link, get_month_link, get_day_link

Sponsored Link