Hi,
Thank you for contacting us and I'd be happy to assist.
To implement a conditional check for multiple options in the checkboxes type field, it would be better to register a custom shortcode:
add_shortcode( 'custom_field_contains_check', 'custom_field_contains_check_func');
function custom_field_contains_check_func($atts) {
$field = $atts['field'];
$value = $atts['value'];
$result = '0';
if(!empty($field) && !empty($value)) {
$field_content = types_render_field( $field, array( "separator" => ",", "output" => "raw" ) );
if(!empty($field_content)) {
$field_content_arr = explode(',', $field_content);
if( in_array( $value, $field_content_arr ) ) {
$result = '1';
}
}
}
return $result;
}
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.
Next, please also add "custom_field_contains_check" in the "Third-party shortcode arguments" section, at WP Admin -> Toolset -> Settings -> Front-end Content.
This shortcode accepts two parameters:
field: slug of the custom field to check the value from
value: value to check if it exists or not
The shortcode will return '0' if the value doesn't exist and '1' if the value exists.
And then you can use this shortcode in your conditional checks, like this:
To check for the value '2020', for the field "partner-awards"
[wpv-conditional if="( '[custom_field_contains_check field='partner-awards' value='2020']' eq '1' )"]
[wpv-post-title]<br>
[/wpv-conditional]
To check for the value '2021', for the field "partner-awards":
[wpv-conditional if="( '[custom_field_contains_check field='partner-awards' value='2021']' eq '1' )"]
[wpv-post-title]<br>
[/wpv-conditional]
And so on, for the other year value options, that you'll add in the future.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar