Php 在插件短标签中添加customfield
我正在使用wordpress插件短标签,它需要一个字段来通过自定义字段加载。我想知道如何在插件php代码中回显customfield。我是php的初学者,因此无法理解: 这是我的密码:Php 在插件短标签中添加customfield,php,wordpress,variables,custom-fields,shortcode,Php,Wordpress,Variables,Custom Fields,Shortcode,我正在使用wordpress插件短标签,它需要一个字段来通过自定义字段加载。我想知道如何在插件php代码中回显customfield。我是php的初学者,因此无法理解: 这是我的密码: <?php $custom_fields = get_post_custom(); $my_custom_field = $custom_fields['donationbar']; foreach ( $my_custom_field as $value ) echo "$value"; ###
<?php
$custom_fields = get_post_custom();
$my_custom_field = $custom_fields['donationbar'];
foreach ( $my_custom_field as $value )
echo "$value"; ### <-- that value
我想在目标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
);
$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
);