编辑“WordPress:Function Reference/wp get attachment url”
该编辑可以被撤销。 请检查下面的对比以核实您想要撤销的内容,然后发布下面的更改以完成撤销。
最后版本 | 您的文本 | ||
第1行: | 第1行: | ||
==描述 == | ==描述 == | ||
Returns a full URI for an [[WordPress:Using_Image_and_File_Attachments|attachment file]] or <var>false</var> on failure. | |||
返回[[WordPress:Using_Image_and_File_Attachments|附属文件]]完全URI或者没有URI,返回<var>false</var> | 返回[[WordPress:Using_Image_and_File_Attachments|附属文件]]完全URI或者没有URI,返回<var>false</var> | ||
<! | <!-- Wordpress uses this function to generate a link when you insert an attachment into a post and choose <tt>Linked to file</tt>. --> | ||
<!—当你向一篇文章插入附属设置,并且选择<tt>链接到文件</tt>的时候,Wordpress使用这个函数,产生一个链接--> | |||
== Example usage & output == | |||
== 例子用法 &输出 == | == 例子用法 &输出 == | ||
%%%<?php echo wp_get_attachment_url(12); ?>%%% outputs something like <tt><nowiki>http://wp.example.net</nowiki>/wp-content/uploads/<var>filename</var></tt> | |||
%%%<?php echo wp_get_attachment_url(12); ?>%%% 产出内容像<tt><nowiki>http://wp.example.net</nowiki>/wp-content/uploads/<var>文件名</var></tt> | %%%<?php echo wp_get_attachment_url(12); ?>%%% 产出内容像<tt><nowiki>http://wp.example.net</nowiki>/wp-content/uploads/<var>文件名</var></tt> | ||
== Parameters == | |||
== 参数 == | == 参数 == | ||
{{Parameter|id|integer|The ID of the desired attachment|required}} | |||
{{Parameter|id|integer|需要的附属内容的ID|required}} | {{Parameter|id|integer|需要的附属内容的ID|required}} | ||
== Related == | |||
==相关的== | ==相关的== | ||
== Description == | |||
== 描述 == | == 描述 == | ||
You can change the output of this function through the [[WordPress:Plugin_API/Filter_Reference#Link_Filters|wp_get_attachment_url]] filter. | |||
你可以通过[[WordPress:Plugin_API/Filter_Reference#Link_Filters|wp_get_attachment_url]]过滤器更改这个函数的输出。 | 你可以通过[[WordPress:Plugin_API/Filter_Reference#Link_Filters|wp_get_attachment_url]]过滤器更改这个函数的输出。 | ||
If you want a URI for the [[WordPress:Templates_Hierarchy#Attachment_page|attachment page]], not the attachment file itself, you can use [[WordPress:Template_Tags/get_attachment_link|get_attachment_link]]. | |||
如果你想要[[WordPress:Templates_Hierarchy#Attachment_page|附属网页]]的URI,而不是附属文件本身,你可以使用[[WordPress:Template_Tags/get_attachment_link|get_attachment_link]]。 | 如果你想要[[WordPress:Templates_Hierarchy#Attachment_page|附属网页]]的URI,而不是附属文件本身,你可以使用[[WordPress:Template_Tags/get_attachment_link|get_attachment_link]]。 |