在插件中添加自定义字段标签
问题描述:
我正在使用需要一个字段通过自定义字段加载的wordpress插件短标签。我想知道如何在插件php代码中回显自定义字段。我在PHP初学者所以不知道这一点:在插件中添加自定义字段标签
这里是我的代码:
<?php
$custom_fields = get_post_custom();
$my_custom_field = $custom_fields['donationbar'];
foreach ($my_custom_field as $value)
echo "$value"; ### <-- that value
我想这个数值去下面的goal_id
:
donation_can_donation_form(
$goal_id = 'VALUE HERE', $show_progress = true, $show_description = true,
$show_donations = false, $show_title = false, $title = "", $return = false
);
我想在goal_id
内加载$value
。这样我只需要在自定义字段中添加目标ID,其余部分将被硬编码到主题中。
答
大声笑我想我明白了!
这里是工作代码:
$custom_fields = get_post_custom();
$my_custom_field = $custom_fields['donationbar'];
foreach ($my_custom_field as $value)
donation_can_donation_form(
$goal_id = $value, $show_progress = true, $show_description = false,
$show_donations = false, $show_title = false, $title = "", $return = false
);