This is useful if you have a custom meta field that uses radio button or ‘select’ input, and you want to display something in a template file depending on the meta value. This can also be used for regular text input meta fields, as well. In the example below, my custom meta field is a radio button named ‘_isa_edp_radio’. If ‘EDP’ is selected, it prints one thing. If ‘EDT’ is selected, it prints another thing. If nothing is selected, it doesn’t print anything.
IF CUSTOM META VALUE IS THIS OR THAT, DO THIS OR THAT:
$key = '_isa_edp_radio'; $edpedt = get_post_meta( $post->ID, $key, true ); if ( $edpedt == 'EDP' ) { echo 'Eau de Parfum'; } elseif ( $edpedt == 'EDT' ) { echo 'Eau de Toilette'; }
Questions and Comments are Welcome