所有分类
  • 所有分类
  • APP源码

dvanced Custom Fields是一款自定义文章字段的插件,功能较为强大,字段可以分组来指派,那么我们如何显示某个字段组下的字段呢?

也就是如何get fields from group,我们需要用到一个方法get_field_object。

<?php 
//or insert the ID of your fields Group.
$groupID='116';
$custom_field_keys = get_post_custom_keys($groupID);
foreach ( $custom_field_keys as $key => $fieldkey )
{
if (stristr($fieldkey,'field_'))
{
//echo $key . " => " . $fieldkey . "<br />";
//echo $field['label'] . ': ' . $field['value'];
//echo $fieldkey . "<br />";
$field = get_field_object($fieldkey, $groupID);

$acf_field_name = $field['name'];

$attachment = get_field($acf_field_name);
echo "<img src='".$attachment['url']."' title='".$attachment['title']."'/>";


}
}

?>

 

资源下载
下载价格99 环亚币
钻石免费
购买下载说明
0

评论0

C907-即时通讯--欧信升级版-双端全模块文件
C907-即时通讯--欧信升级版-双端全模块文件
5分钟前 有人购买 去瞅瞅看

站点公告

(Dear)亲,( Huanya Resource Station is now open!)现在环亚资源站已开站! (All resources can watch content, and we have enabled payment!)所有资源可以观看内容,我们已经开启了支付功能! (Consult customer service before placing an order to enjoy a 20% discount. Thank you for your attention and trust. We will show you better and higher-quality resources.)下单前咨询客服享受8折优惠,感谢您的关注信赖,我们将展示更好更优质的资源给您
显示验证码
没有账号?注册  忘记密码?