The scenario is as follows: the user marks "checkboxes" options in the corresponding meta-field in the admin panel and the output (depending on the option chosen) is executed shortcode.
I wrote the php-code myself, but it gets bulky. I would like to clarify how to optimize it correctly. Here is an abstract example for one option:
if ( in_array( 'Чай', get_field('meal_type') ) ) { the_content(); do_shortcode("[tea]"); } Everything here works and information is displayed as needed. But if there are many such fields, then the code is cumbersome (if described separately).
How to immediately combine the necessary categories of meta-fields in the selection and execute the appropriate shortcodes for them and display the information after the_content() function?
For example:
the_content(); array(){ 'Чай' -> do_shortcode['tea'], 'Кофе' -> do_shortcode['coffee'], ... }