Skip to content

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

@Nanosergio

Description

@Nanosergio

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions