Meta Box
Support › General › If Then QuestionResolved
I want to change how a field is displayed on the frontend depending on the rwmb_meta(), kind of like this:
<?php if( rwmb_meta() = '1' ) { ?> ... <?php } elseif( rwmb_meta() = '2' ) { ?> ... <?php } elseif( rwmb_meta() = '3' ) { ?> ... <?php } else { ?> ... <?php } ?>
where the number after = is whatever the value of rwmb_meta() is.
I know how to do this with general WP elements such as category or page, but how would I do it for Meta Box fields?
Hi Rebecca,
To compare two values, please use the equal comparison operator ==
==
<?php if( rwmb_meta('field_id') == '1' ) { ?>
Get more details here https://www.php.net/manual/en/language.operators.comparison.php
Thank you!