I am using a PHP function with a simple if else statement. If variable = 100 do something, else do something else.
The data is coming from an ACF Range Field. For some reason, the function always returns the else-statement even though the ACF field is = 100. I figured the problem is the if-statement where I've tried to use: =, ==, !==, === or >=. If I change it to single = then it always returns h2 Something but all the rest returns h2 something else no matter what value I put in the ACF Range field.
function hovsa_shortcode() {
$full_tegnet = get_field("tegnede_andele_");
if ( $full_tegnet == '100' ) {
return '<h2>Something</h2>';
} else {
return '<h2>Something else</h2>';
}
}
add_shortcode( 'hovsa', 'hovsa_shortcode' );
Aucun commentaire:
Enregistrer un commentaire