get_month_link

Sponsored Link

PHPでの使用のために特定の年と1カ月まで毎月のアーカイブURLを返します。 それはURLを表示しません。 年と月のパラメタがに設定されるなら、タグは現在の月のアーカイブのためにURLを返します。

Sponsored Link

Returns the monthly archive URL to a specific year and month for use in PHP. It does NOT display the URL. If year and month parameters are set to , the tag returns the URL for the current month’s archive.

タグ使用方法

<?php get_month_link('year', 'month'); ?>

Month Archive as Link

リンクとしてPHPエコーコマンドと共にアンカータグの中にそれを表示することによって、URLを現在の月のアーカイブに返します。

Returns the URL to the current month’s archive as a link by displaying it within an anchor tag with the PHP echo command.

<a href="<?php echo get_month_link(<i>, </i>); ?>">All posts this month</a>

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.

<?php $year03 = get_year_link(2003); ?></pre>
<h4>Assigning Specific Month to Variable</h4>
<p>それを可変$oct_04に割り当てて、URLを2004年10月のためのアーカイブに返します。 そして、1ページのほかの場所で変数を使用することができます。 </p>
<blockquote>Returns URL to the archive for October 2004, assigning it to the variable $oct_04. The variable can then be used elsewhere in a page. </blockquote>
<?php $oct_04 = get_month_link('2004', '10'); ?>

Use With PHP Variables

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

PHP code block for use within The Loop: Assigns year and month of a post to the variables $arc_year and $arc_month. These are used with the get_month_link() tag, which returns the URL as a link to the monthly archive for that 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.

<?php
$arc_year = get_the_time('Y');
$arc_month = get_the_time('m');
?>

<a href="<?php echo get_month_link("$arc_year", "$arc_month"); ?>">archive
for <?php the_time('F Y') ?></a>

Parameters

year

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

month

(integer) The month for archive. Use to assign current month.

関連テンプレートタグ

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

Sponsored Link