web-dev-qa-db-ja.com

カスタムフィールドの値を変数に入れる方法

function zh_get_invoice_round_off_number() 
    {
        global $post;
        return get_post_meta($post->ID, 'invoice_round_off_number', true);
    }

    function zh_invoice_round_off_number() 
    {
        echo zh_get_invoice_round_off_number();
    }
1
user2506619

ループの中 :

$custom_fields = get_post_custom(the_ID());
$my_custom_field = $custom_fields['zh_invoice_round_off_number'];
convert_number((int)$my_custom_field);

またはあなたの機能で:

$custom_value = zh_get_invoice_round_off_number();
echo convert_number( (int) $custom_value );
1
Tolea Bivol