February 27, 2019
Great to use on product pages to reveal varied standardized text from the template when Products use shared terms like colours, or sizes.
Using Advanced Custom Fields:
<?php $colours = get_field('product_field_name'); if (strpos($colours, 'Sizes') !== false){ } // hide content for sizes if (strpos($colours, 'Colours') !== false || strpos($colours, 'Colors') !== false ){ // show content for colours } ?>
Using get_post_meta:
<?php $colours = get_post_meta(get_the_ID,'product_field_name',true); if (strpos($colours, 'Sizes') !== false){ } // hide content for sizes if (strpos($colours, 'Colours') !== false || strpos($colours, 'Colors') !== false ){ // show content for colours } ?>