To assign the Custom Field value to a Variable we use the function get_cfc_field().
In The Loop:
/*
* Let's say we want to retrieve the Upload Field Image (the slug will be image) from a Single Meta Box
*/
/*
* For a image the attachment object looks like this:
array(
'id' => 151,
'alt' => 'Avatar Image',
'title' => 'John',
'caption' => 'Our number on member',
'description' => 'a avatar image',
'url' => "http://www.yourdomain.com/wordpress/wp-content/uploads/2013/10/John.jpg",
'width' => "100",
'height' => "120",
'sizes' => Array
(
[thumbnail] => "http://www.yourdomain.com/wordpress/wp-content/uploads/2016/10/John-150x150.jpg",
[medium] => "http://www.yourdomain.com/wordpress/wp-content/uploads/2016/10/John-300x119.jpg",
[large] => "http://www.yourdomain.com/wordpress/wp-content/uploads/2016/10/John.jpg"
)
);
*/
Outside The Loop:
/*
* Let's say we want to get the field Bio (the slug will be bio)
* From a Single Meta Box from the post with the id 153
*/
For the Repeater Meta Box we also need the function get_cfc_meta().
In The Loop:
/*
* Let's say we want to get all the fields Author (the slug will be author) of the Field Type User Select
* From a Repeater Meta Box
*/
$value ){ ?>
/*
* $author contains the following:
array(11) {
["ID"] => "33"
["user_firstname"] => "John"
["user_lastname"] => "Smith"
["nickname"] => "J.Smith"
["user_nicename"] => "johnsmith"
["display_name"] => "John Smith"
["user_email"] => "jsmith@mail.com"
["user_url"] => "www.johnswebsite.com"
["user_registered"] => "2012-08-16 09:58:36"
["user_description"] => "Biology Teacher"
["user_avatar"] => ""
}
*/
Outside The Loop:
/*
* Let's say we want to get all the fields Date (the slug will be date)
* From a Repeater Meta Box from the post with the id 252
*/
$value ){ ?>
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