Custom Function
-
Hi all,
I’m trying to make a custom function in my functions.php in a Child Theme directory.
That’s the function:
function conserva($estado_iunc){ global $wpdb; switch($estado_iunc) { case EX: $iunc_desc = "Extinta"; break; case EW: $iunc_desc = "Extinta na Natureza"; break; case CR: $iunc_desc = "Criticamente em Perigo"; break; case EN: $iunc_desc = "Em Perigo"; break; case VU: $iunc_desc = "Vulnerável"; break; case NT: $iunc_desc = "Quase Amea?ada"; break; case LC: $iunc_desc = "Pouco Preocupante"; break; case DD: $iunc_desc = "Dados Deficientes"; break; case NE: $iunc_desc = "N?o Avaliada"; break; } return $iunc_desc; } add_action( 'init', 'conserva', 25 );
And the file calling the function:
<h6>Estado de Conserva??o - <?php conserva(the_field('esp_estado_de_conserva??o')); ?></h6>
Where
the_field('esp_estado_de_conserva??o')
Is an ACF SELECT Custom Field.
It’s showing “LC”, instead of “Pouco Preocupante”.
Any clue?
Ty in advance
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Custom Function’ is closed to new replies.