Support » Plugin: Church Community Builder Core API » Post Meta main_leader

  • Resolved Oikos


    I’m trying to obtain name values from main_leader Post Meta. Everything is returning in an array of content. I only want to display name values for full_name and email.
    I want to display them like this:

    Leader: Leader Name
    Leader Email:

    Can you help? Thanks!

    • This topic was modified 2 years, 3 months ago by Oikos.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jared Cobb


    Hi @oikos,

    Yes, it looks like the template is outputting the entire array. Can you share the few lines of code in that template?

    You ultimately need to output the specific elements of the array, similar to this:

    echo esc_html( $main_leader['full_name'] );

    But if I can see a snippet of how you’re currently outputting that array I can probably help.

    Here’s what I used to find the values:
    $key_values = get_post_custom_values( ‘main_leader’ );

    foreach ( $key_values as $key => $value ) {
    echo “$value <br />”;

    Plugin Author Jared Cobb


    I see. The get_post_custom_values() function will return an array of arrays which can be a bit confusing.

    A better way to handle getting custom fields is using the get_post_meta() function. Here’s a specific example for you:

    $main_leader = get_post_meta( get_the_ID(), 'main_leader', true );
    if ( ! empty( $main_leader['full_name'] ) ) {
    	echo '<strong>Leader:</strong> ' . $main_leader['full_name'] . '<br>';
    if ( ! empty( $main_leader['email'] ) ) {
    	echo '<strong>Leader Email:</strong> ' . $main_leader['email'] . '<br>';

    Note that you should almost always pass true as the third parameter for get_post_meta() while using this plugin.

    Does that work for you?

    This worked for me. Is there anyway to grab the image url of the main leader?

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Post Meta main_leader’ is closed to new replies.