My-Meta-Box
My-Meta-Box copied to clipboard
Select Field. How to display the name... not the id
First of all, thanks for this wonderful class.
Using WordPress native function get_the_title() doesn't work for me :(
$my_meta->addSelect($prefix.'select_concurso_destinatarios',array('destinatario1'=>'Estudiantes de Grado','destinatario2'=>'Estudiantes de Máster','destinatario3'=>'Estudiantes de Doctorado','destinatario4'=>'Estudiantes sin nivel especificado','selectkey5'=>'No especificado'),array('name'=> 'Destinatarios', 'multiple'=>true));
<?php echo get_post_meta( $post->ID, 'ba_select_concurso_destinatarios', true );?>
When I fill this field it displays:
Result: destinatario1
<?php echo get_the_title(get_post_meta( $post->ID, 'ba_select_concurso_destinatarios', true ));?>
When I fill this field it displays:
Result:
When empty it shows the title of the post
Result: Michelin Challenge Design “Inspiring Mobility”
It worked for post fields but not for select field.