Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select Field. How to display the name... not the id #152

Open
Nanosergio opened this issue Mar 27, 2022 · 0 comments
Open

Select Field. How to display the name... not the id #152

Nanosergio opened this issue Mar 27, 2022 · 0 comments

Comments

@Nanosergio
Copy link

Nanosergio commented Mar 27, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant