Table of Contents
To display Custom Fields values we use the function the_cfc_field().
In The Loop:
1 2 3 4 5 | /* *Let's say we want to display the field Last Name (the slug will be last-name) from a Single Meta Box */ Name: <?php the_cfc_field('my_meta_name', 'last-name'); ?> |
Outside The Loop:
1 2 3 4 5 6 | /* * Let's say we want to display the field Description (the slug will be description) * From a Single Meta Box, from the post with id 46 */ Description: <?php the_cfc_field('my_meta_name', 'description', 46 ); ?> |
Besides the function the_cfc_field() for a repeater we also need get_cfc_meta() function.
In The Loop:
1 2 3 4 5 6 7 | /* * Let's say we want to display all the fields Last Name (the slug will be last-name) from a Repeater Meta Box */ <?php foreach( get_cfc_meta( 'my_meta_name' ) as $key => $value ){ ?> Name: <?php the_cfc_field( 'my_meta_name','last-name', false, $key ); ?> <?php } ?> |
Outside The Loop:
1 2 3 4 5 6 7 8 | /* * Let's say we want to display all the fields Description (the slug will be description) * From a Repeater Meta Box, from the post with id 46 */ <?php foreach( get_cfc_meta( 'my_meta_name' ) as $key => $value ){ ?> Description: <?php the_cfc_field( 'my_meta_name','description', 46, $key ); ?> <?php } ?> |
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