开发者

Add customfield inside a plugin shorttag

I'm using a wordpress plugin shorttag which needs one field to load through a custom field. I want to know how I can echo the customfield inside the plugin php code. I'm a beginner in php so can't figure this out:

Here's my code:

<?php

$custom_fields = get_post_custom();
$my_c开发者_开发知识库ustom_field = $custom_fields['donationbar'];
foreach ( $my_custom_field as $value )
    echo "$value"; ### <-- that value

I want this value to go in the goal_id below:

donation_can_donation_form(
    $goal_id = 'VALUE HERE', $show_progress = true, $show_description = true,
    $show_donations = false, $show_title = false, $title = "", $return = false
);

I want to load the $value inside the goal_id. This way I will only need to add the ID of the goal in the custom fields and the rest will be hardcoded into the theme.


Lol I think I got it!

Here is the working code:

$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
);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜