Table of Contents
This Default Field Type is available in WordPress Creation Kit free version. The Currency Select Field allows a currency to be selected from a dropdown list.
To add a Currency Select Field to a previously created Custom Meta Box, under the Meta Box Fields tab simply insert a Field Title and under Field Type make sure you select Currency Select.
The Currency Select Field contains options to customize it:
This is how the Currency Select Field we created above looks like in the Edit Screen:
The following examples are for a Custom Meta Box with the “Group Name” argument “my_meta_name“. Make sure to replace this with the “Group Name” you have set up. The Custom Meta Box below is setup to be attached to a post.
The Currency Field returns a string containing the currency code.
To output a value inside The Loop we use the function the_cfc_field():
Value:
To assign the value to a variable we use the function get_cfc_field():
To output all the “My Currency” entries from the repeater field we use the functions get_cfc_meta() and the_cfc_field():
$value ){
the_cfc_field( 'my_meta_name','my-currency', false, $key );
}
?>
To output a specific “My Currency” entry from the repeater field (e.g. the second entry), we use the function the_cfc_field():
The index starts at 0 so that’s why we pass “1” to the function. For the first entry it would be “0”, the second is “1”, the third is “2” and so on…
ID, 'my_meta_name', true );
if( !empty( $my_meta[0]['my-color'] ) )
echo 'Value:'.$my_meta[0]['my-color'];
?>
To output all the “My Currency” entries in the repeater field:
ID, 'my_meta_name', true );
if( !empty( $my_meta ) ){
foreach( $my_meta as $entry ){
echo $entry['my-currency'];
}
}
?>
To output a specific “My Currency” entry from the repeater field (e.g. the second entry):
ID, 'my_meta_name', true );
if( !empty( $my_meta[1]['my-currency'] ) )
echo $my_meta[1]['my-currency'];
?>
The index starts at 0 so that’s why we pass “1” to the function. For the first entry it would be “0”, the second is “1”, the third is “2” and so on…
ID, 'my-color', true );
/* get the third entry */
$third_value = get_post_meta( $post->ID, 'my-color_2', true );
?>
Combine the power of Profile Builder with Paid Member Subscriptions to set up user registration, memberships, and recurring revenue.
Get 25% off with the bundle