lundi 28 décembre 2015

ACF Checkbox value

I have an Advanced Custom Field (repeater) setup. In the admin area of the page where these custom fields live are 3 options (Standard, Professional and Enterprise). It's setup so you can see what features are built in to each level of subscription. So there's 15 features. The Standard feature has the first 10 included. The Professional feature has the first 10 (as in the Standard) plus the next 3 features. The Enterprise level has the first 10 (as in the Standard) plus the 3 that the Professional level has and the last 2 features (only the Enterprise has the last 2 features).

I've been searching and trying many different things but cannot get what I'm after. I'm programming the page in 3 blocks on mobile to match the 3 levels. The first block will represent the Standard level and will list all 10 features it has. The next block will house the Professional level but instead of listing all the duplicate 10 that Standard has, it will read, "Same features as Standard, plus", then it will list the next 3 associated with the Professional level. Then comes the Enterprise level block. This will also read, " Same features and Standard and Professional, plus"... then it will list the last two features.

I'm having a real hard time getting the display to only display the features for Professional and Enterprise.

The code below is what I have now but because Enterprise has all of those features, it displays them all instead of just the features that only have Enterprise. The same with Professional. They are both displaying all the features that Standard has too because they all have them. I just cannot figure out the right check to only display the new features that the other doesn't have.

Here is my bit of code for Professional:

<?php $professional = get_sub_field('feature_software_version'); ?>
        <?php if( in_array('professional', $professional) ) { ?>
                <span class="featureshead"><?php the_sub_field('feature_headline'); ?></span><br />
            <?php } else { ?>
            <?php } ?>

Here is my bit of code for Enterprise:

<?php $enterprise = get_sub_field('feature_software_version'); ?>
        <?php if ( in_array('enterprise', $enterprise ) )  {    ?>

                <span class="featureshead"><?php the_sub_field('feature_headline'); ?></span><br />

        <?php } else { ?>
        <?php } ?>




Aucun commentaire:

Enregistrer un commentaire