Add ID to output only for first option

Instead of using an if check, use filter_var() so that any boolean-ish value can be passed in the shortcode attribute; e.g., yes, no, on, off, true, false, 0, 1.

$no = filter_var( $no, FILTER_VALIDATE_BOOLEAN );

Now, $no is either true or false (boolean).


Sorry, I see $no is actually a number. My mistake.

if ( $no === '0' ) {
    $no = 0;
} else {
    $no = (int) $no;
}

Uses strict comparison ===