Skip to content

Conditions not working on Typography controls. #6780

@notrealdev

Description

@notrealdev

Hi, the below code not working with Typography control
// Typography alway show although date and author switch off

// Date.
$this->add_control(
	'date',
	array(
		'type'         => Controls_Manager::SWITCHER,
		'label'        => esc_html__( 'Publish Date', 'wordpress' ),
		'default'      => '',
		'label_on'     => esc_html__( 'Yes', 'wordpress' ),
		'label_off'    => esc_html__( 'No', 'wordpress' ),
		'return_value' => 'yes',
	)
);
// Author.
$this->add_control(
	'author',
	array(
		'type'         => Controls_Manager::SWITCHER,
		'label'        => esc_html__( 'Author', 'wordpress' ),
		'default'      => '',
		'label_on'     => esc_html__( 'Yes', 'wordpress' ),
		'label_off'    => esc_html__( 'No', 'wordpress' ),
		'return_value' => 'yes',
	)
);

// Typography.
$this->add_group_control(
	Group_Control_Typography::get_type(),
	array(
		'name'       => 'post_meta',
		'label'      => __( 'Typography', 'wordpress' ),
		'scheme'     => Scheme_Typography::TYPOGRAPHY_1,
		'selector'   => '{{WRAPPER}} .meta-item',
		'conditions' => [
			'relation' => 'or',
			'terms'    => [
				[
					'name'     => 'date',
					'operator' => '===',
					'value'    => 'yes',
				],
				[
					'name'     => 'author',
					'operator' => '===',
					'value'    => 'yes',
				],
			],
		],
	)
);

Can you check it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates a bug with one or multiple components.status/mergedIndicates when a Pull Request has been merged to a Release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions