Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional logic based on checkbox #78

Open
clubdeuce opened this issue Feb 11, 2021 · 1 comment
Open

Conditional logic based on checkbox #78

clubdeuce opened this issue Feb 11, 2021 · 1 comment

Comments

@clubdeuce
Copy link

clubdeuce commented Feb 11, 2021

When attempting to use conditional logic based on a checkbox, showing a sibling field when the checkbox is checked works as expected. However, only showing a field when the checkbox is unchecked does not:

Field::make_checkbox( 'curate_selection', _x( 'Curate the selection?', 'custom field label', 'xxx' ) )
	->set_option_value( true ),
Field::make_association( 'da_resource_types', __( 'DA Resource Types', 'scustom field label', 'xxx' ) )
	->set_conditional_logic( array(
		array(
			'field' => 'curate_selection',
			'value' => false,
		),
	) )
	->set_types( array(
		array(
			'type' => 'term',
			'taxonomy' => 'da_resource_type',
		),
	) ),
Field::make_association( 'da_resources', __( 'DA Resources', 'custom field label', 'xxx' ) )
	->set_max( 3 )
	->set_conditional_logic( array(
		array(
			'field' => 'curate_selection',
			'value' => true,
		),
	) )
	->set_types( array(
	     array(
		     'type'      => 'post',
		     'post_type' => 'da_resource',
	     ),
	) )
@clubdeuce
Copy link
Author

I should add that this is in a block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant