WordPress:Function Reference/get post custom values
Description
描述
Returns an array containing all the values of the custom fields with a particular key ($key) of a particular post ($post_id). Returns nothing if no such key exists, or none is entered. See also get_post_custom() and get_post_custom_keys().
返回一个数组,包含某篇文章($post_id)某关键字($key)自定义fields的所有参数值。如果不存在这样的关键字,或者没有输入任何内容,不返回任何内容。也看看get_post_custom() 和get_post_custom_keys()。
Usage
用法
%%% <?php get_post_custom_values($key, $post_id); ?> %%%
%%% <?php get_post_custom_values($key, $post_id); ?> %%%
Examples
Default Usage
例子
默认用法
The following example sets a variable ($mykey_values) as an array containing the values of the custom fields of the current post with the key my_key.
<?php 下面的例子将一个变数(<tt>$mykey_values</tt>)设置为一个数组,包含关键字为''my_key''的当前文章的自定义fields的参数值。 <pre><?php $mykey_values = get_post_custom_values('my_key'); foreach ( $mykey_values as $key => $value ) { echo $key . " => " . $value . "<br />"; } ?>
0 => First value with "my_key" as its key
1 => Second value with "my_key" as its key
2 => Third value with "my_key" as its key
etc...
$mykey_values = get_post_custom_values('my_key'); foreach ( $mykey_values as $key => $value ) { echo $key . " => " . $value . "
"; }
?>
0 => First value with "my_key" as its key
1 => Second value with "my_key" as its key
2 => Third value with "my_key" as its key
etc...
Parameters
参数
Related
相关的
add_post_meta(), delete_post_meta(), get_post_meta(), update_post_meta(), get_post_custom(), get_post_custom_keys()
add_post_meta(), delete_post_meta(), get_post_meta(), update_post_meta(), get_post_custom(), get_post_custom_keys()