Retrieving data
Because Cuztom uses the builtin meta functions, retrieving data is very easy.
$postMeta = get_post_meta(get_the_ID(), '_data_text_field', true);
$termMeta = get_term_meta(get_queried_object_id(), '_data_text_field', true);
$userMeta = get_user_meta(get_the_ID(), '_data_text_field', true);
Term Meta
Image fields
When using an image field, Cuztom only stores the attachment ID, so retrieving the data is a little bit different.
$data = get_post_meta(get_the_ID(), '_data_text_field', true);
$image = wp_get_attachment_image($data);
Read more about wp_get_attachment_image on the Wordpress Codex.
Bundles
The bundles are stored in an array using the bundle's ID.
$data = get_post_meta(get_the_ID(), '_bundle_name', true);
This will print out an array in the following format:
Array
(
[0] => Array
(
[_field_id] => Field Value
[_another_field_id] => Another Field Value
)
[1] => Array
(
[_field_id] => Field Value
[_another_field_id] => Another Field Value
)
...
[n] => Array
(
[_field_id] => Field Value
[_another_field_id] => Another Field Value
)
)
Updated about 7 years ago