Support

Account

Home Forums Front-end Issues Hidden-by-conditional-logic get posted and create problems. Reply To: Hidden-by-conditional-logic get posted and create problems.

  • Actually I managed to solve it, by adding extra check before getting and echoing the field with this structure:

    <?php
    $make = get_post_meta($post_id, 'add-info-cat-auto_0_car-stamp');
    if (get_post_meta($post_id, 'add-info-cat-auto_0_car-stamp')) {
        echo $make[0] . ':';
    } if ($make[0] === 'Acura') {
        $model = get_post_meta($post_id, 'add-info-cat-auto_0_car-model-acura');
        echo $model[0];
    } elseif ($make[0] === 'Alfa Romeo') {
        $model = get_post_meta($post_id, 'add-info-cat-auto_0_car-model-alfa-romeo');
        echo $model[0];
    } elseif ($make[0] === 'Audi') {
        $model = get_post_meta($post_id, 'add-info-cat-auto_0_car-model-audi');
        echo $model[0];
    }
    ?>

    Since my car-make options are stored in one select, and models are in different selects it works better than clearing the values because you can’t really have 2 models. Thanks for you help again, have an awesome day! 🙂