Return custom value from get_post_meta
-
Hey all, I am trying to return the custom value from my meta box select option array (excuse me for improper terminology). My current code is returning the first option value (ivory_homes) whereas I need it to return the proper name (Ivory Homes).
Please see my code snippets below. Any help is appreciated!
My meta box:
// Builder Name array( 'name' => __('Builder Name'), 'id' => "builder", 'type' => 'select', 'options' => array( 'ivory_homes' => __('Ivory Homes'), 'liberty_homes' => __('Liberty Homes'), 'rainey_homes' => __('Rainey Homes') ), 'std' => array( '' ), 'desc' => __('Choose from the following options.') ),
…and my php call:
<?php $builder = get_post_meta($post->ID, 'builder', true); if(!empty($builder)) { ?> <strong><?php echo $builder; ?></strong> <?php } ?>
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Return custom value from get_post_meta’ is closed to new replies.