Hello, I’ve run into an issue I cannot quite solve. I am making a comparison chart www.mwdevsite.com/site-care-pricing and I have a text field ‘standard_feature_chart’ inside a repeater ‘comparison_chart’ and I want it to show different elements depending on the value.
Here is the logic:
Render checkmark icon ID=‘ttouzj’ if value of field = ‘yes’
Render line icon ID=‘ptzgsm’ If value of field = ‘no’
Render text element ID=‘xmojre’ if value of field = anything other than ‘yes’ or ‘no’
Here is the code I have so far that is not working. Ive tried many variations with no avail.
add_filter( 'bricks/element/render', function( $render, $element ) {
if ( have_rows( 'comparison_chart' ) ) {
// Loop through rows.
while( have_rows( 'comparison_chart' ) ) : the_row();
//get sub field
$select = get_sub_field_object('standard_feature_chart');
//get value of sub field
$value = $select['value'];
//get the checkmark icon. if the value is yes show the checkmark
if ($element->id === 'ttouzj') {
if ($value != 'yes') {
return false;
}
}
//get the line icon. if the value is no show the line icon
if ($element->id === 'ptzgsm') {
if ($value != 'no') {
return false;
}
}
//get the text element. if the value is not yes or no, show the text element
if ($element->id === 'xmojre') {
if ($value = 'yes' || $value = 'no') {
return false;
}
}
endwhile;
}
return $render;
}, 10, 2 );
any help would be appreciated.