Table of Contents
To get the values stored in the post meta we use the function get_post_meta().
For a Single Meta Box, with the fields Testimonial Author and Testimonial Content, to display the fields using the default WordPress functions we use the following code:
1 2 3 4 5 6 7 | <?php $testimonial_entry = get_post_meta( $post->ID, 'testimonial_meta_name', true ); if( !empty( $testimonial_entry[0]['testimonial-author'] ) && !empty( $testimonial_entry[0]['testimonial-content'] ) ){ echo 'Author:'.$testimonial_entry[0]['testimonial-author']; echo 'Testimonial:'.$testimonial_entry[0]['testimonial-content']; } ?> |
For a Repeater Meta Box with the fields Team Member Name, Team Member Position, Team Member Description we use the following code:
1 2 3 4 5 6 7 8 9 10 | <?php $team_members = get_post_meta( $post->ID, 'team_members', true ); if( !empty( $team_members ) ){ foreach( $team_members as $team_member ){ echo 'Name:'.$team_member['team-member-name']; echo 'Position:'.$team_member['team-member-position']; echo 'Description:'.$team_member['team-member-description']; } } ?> |
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