Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

jsarnowski / jsarnowski/elementor-pro   php

Repository URL to install this package:

Version: 3.2.1 

/ theme-builder / conditions / any-child-of.php

<?php
namespace ElementorPro\Modules\ThemeBuilder\Conditions;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

class Any_Child_Of extends Child_Of {

	public function get_name() {
		return 'any_child_of';
	}

	public function get_label() {
		return __( 'Any Child Of', 'elementor-pro' );
	}

	public function check( $args ) {
		if ( ! is_singular() ) {
			return false;
		}

		$id = (int) $args['id'];
		$parents = get_post_ancestors( get_the_ID() );

		return ( ( 0 === $id && ! empty( $parents ) ) || in_array( $id, $parents ) );
	}
}