WordPress: Template Tags/get day link:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == Description == Returns the daily archive URL to a specific year, month and day for use in PHP. It does NOT display the UR...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== Description ==
== 描述 ==


Returns the daily archive [[WordPress:Glossary#URI and URL|URL]] to a specific year, month and day for use in [[WordPress:Glossary#PHP|PHP]]. It does NOT display the URL. If year, month and day parameters are set to <tt>&#39;&#39;</tt>, the tag returns the URL for the current day's archive.
Returns the daily archive [[WordPress:Glossary#URI and URL|URL]] to a specific year, month and day for use in [[WordPress:Glossary#PHP|PHP]]. It does NOT display the URL. If year, month and day parameters are set to <tt>&#39;&#39;</tt>, the tag returns the URL for the current day's archive.
返回某年某月某日的归档[[WordPress:Glossary#URI and URL|URL]],用于[[WordPress:Glossary#PHP|PHP]]中。不显示URL。如果年份和月份和日参数设置为<tt>&#39;&#39;</tt>,标签返回了当日归档的URL。


== Usage ==
== Usage ==
== 用法 ==
%%% <?php get_day_link('year', 'month', 'day'); ?> %%%


%%% <?php get_day_link('year', 'month', 'day'); ?> %%%
%%% <?php get_day_link('year', 'month', 'day'); ?> %%%


== Examples ==
== Examples ==
== 例子==


=== Current Day as Link ===
=== Current Day as Link ===
=== 当天作为链接 ===


Returns the URL to the current day's archive as a link by displaying it within an anchor tag with the PHP echo command.  
Returns the URL to the current day's archive as a link by displaying it within an anchor tag with the PHP echo command.  
返回当天存档的URL,作为链接,将这个URL放到一个anchor标签中和PHP echo命令一起显示。


  &lt;a href="<?php echo get_day_link(<nowiki>''</nowiki>, <nowiki>''</nowiki>, <nowiki>''</nowiki>); ?>"&gt;Today's posts&lt;/a&gt;
  &lt;a href="<?php echo get_day_link(<nowiki>''</nowiki>, <nowiki>''</nowiki>, <nowiki>''</nowiki>); ?>"&gt;Today's posts&lt;/a&gt;
&lt;a href="<?php echo get_day_link(<nowiki>''</nowiki>, <nowiki>''</nowiki>, <nowiki>''</nowiki>); ?>"&gt;Today's posts&lt;/a&gt;


=== Use With Variables ===
=== Use With Variables ===
=== 与变数一起使用 ===


PHP code block for use within [[WordPress:The Loop]]: Assigns year, month and day of a post to the variables $arc_year, $arc_month and $arc_day. These are used with the get_day_link() tag, which returns the URL as a link to the daily archive for that post, displaying it within an anchor tag with the PHP echo command. See [[WordPress:Formatting Date and Time]] for info on format strings used in [[WordPress:Template Tags/get_the time|get_the_time()]] tag.
PHP code block for use within [[WordPress:The Loop]]: Assigns year, month and day of a post to the variables $arc_year, $arc_month and $arc_day. These are used with the get_day_link() tag, which returns the URL as a link to the daily archive for that post, displaying it within an anchor tag with the PHP echo command. See [[WordPress:Formatting Date and Time]] for info on format strings used in [[WordPress:Template Tags/get_the time|get_the_time()]] tag.
[[WordPress:The Loop|The Loop]]内使用的PHP代码块:将一篇文章的年份和月份和日指定为变数$arc_年份, $arc_月份和$arc_日。这些变数与get_day_link()标签一起使用,get_day_link()标签返回URL作为一个链接,连接到文章的每日存档中,在一个anchor 标签中,将它和PHP echo命令一起显示。请看看[[WordPress:Formatting Date and Time|日期和时间格式]],有关用在[[WordPress:Template Tags/get_the time|get_the_time()]]标签中的格式字符串的信息。


  <?php
  <?php
$arc_year = get_the_time('Y');
$arc_month = get_the_time('m');
$arc_day = get_the_time('d');
?>
&lt;a href="<?php echo get_day_link(<nowiki>"$arc_year"</nowiki>, <nowiki>"$arc_month"</nowiki>,
<nowiki>"$arc_day"</nowiki>); ?>"&gt;this day's posts&lt;/a&gt;
<?php
  $arc_year = get_the_time('Y');
  $arc_year = get_the_time('Y');
  $arc_month = get_the_time('m');
  $arc_month = get_the_time('m');
第28行: 第57行:


== Parameters ==
== Parameters ==
== 参数==


; year : (''integer'') The year for the archive. Use <tt>&#39;&#39;</tt> to assign current year.
; year : (''integer'') The year for the archive. Use <tt>&#39;&#39;</tt> to assign current year.
; 年份 : (''整数'')归档的年份。使用<tt>&#39;&#39;</tt>指定当前的年份。
; month : (''integer'') The month for archive. Use <tt>&#39;&#39;</tt> to assign current month.
; month : (''integer'') The month for archive. Use <tt>&#39;&#39;</tt> to assign current month.
; 月份 : (''整数'')归档的月份。使用<tt>&#39;&#39;</tt>指定当前的月份。
; day : (''integer'') The day for archive. Use <tt>&#39;&#39;</tt> to assign current day.
; day : (''integer'') The day for archive. Use <tt>&#39;&#39;</tt> to assign current day.
; 日 : (''整数'')归档的那一日。使用<tt>&#39;&#39;</tt>指定当天。


== Related ==
== Related ==
第38行: 第75行:


{{PHP Function Tag Footer}}
{{PHP Function Tag Footer}}
== 相关的 ==
{{标签 链接标签}}
{{PHP函数标签 页底文字}}

2008年7月5日 (六) 17:30的版本

Description

描述

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

返回某年某月某日的归档URL,用于PHP中。不显示URL。如果年份和月份和日参数设置为'',标签返回了当日归档的URL。

Usage

用法

%%% <?php get_day_link('year', 'month', 'day'); ?> %%%

%%% <?php get_day_link('year', 'month', 'day'); ?> %%%

Examples

例子

Current Day as Link

当天作为链接

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

返回当天存档的URL,作为链接,将这个URL放到一个anchor标签中和PHP echo命令一起显示。

<a href="<?php echo get_day_link('', '', ''); ?>">Today's posts</a>

<a href="<?php echo get_day_link('', '', ''); ?>">Today's posts</a>

Use With Variables

与变数一起使用

PHP code block for use within WordPress:The Loop: Assigns year, month and day of a post to the variables $arc_year, $arc_month and $arc_day. These are used with the get_day_link() tag, which returns the URL as a link to the daily archive for that post, displaying it within an anchor tag with the PHP echo command. See WordPress:Formatting Date and Time for info on format strings used in get_the_time() tag.

The Loop内使用的PHP代码块:将一篇文章的年份和月份和日指定为变数$arc_年份, $arc_月份和$arc_日。这些变数与get_day_link()标签一起使用,get_day_link()标签返回URL作为一个链接,连接到文章的每日存档中,在一个anchor 标签中,将它和PHP echo命令一起显示。请看看日期和时间格式,有关用在get_the_time()标签中的格式字符串的信息。

<?php
$arc_year = get_the_time('Y');
$arc_month = get_the_time('m');
$arc_day = get_the_time('d');
?>
<a href="<?php echo get_day_link("$arc_year", "$arc_month", 
"$arc_day"); ?>">this day's posts</a>


<?php

$arc_year = get_the_time('Y');
$arc_month = get_the_time('m');
$arc_day = get_the_time('d');
?>
<a href="<?php echo get_day_link("$arc_year", "$arc_month", 
"$arc_day"); ?>">this day's posts</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.
月份
(整数)归档的月份。使用''指定当前的月份。
day
(integer) The day for archive. Use '' to assign current day.
(整数)归档的那一日。使用''指定当天。

Related

模板:Tag Link Tags

模板:PHP Function Tag Footer

相关的

模板:标签 链接标签

模板:PHP函数标签 页底文字