| Server IP : 87.98.154.146 / Your IP : 216.73.216.165 Web Server : Apache System : Linux webm004.cluster126.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : ohklomafyi ( 52085) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/ohklomafyi/www/wp-content/plugins/templately/includes/Builder/Conditions/ |
Upload File : |
<?php
namespace Templately\Builder\Conditions;
class Taxonomy extends Condition {
protected $taxonomy;
public function __construct( $args = [] ) {
$this->taxonomy = $args['instance'];
parent::__construct( $args );
}
public function get_priority(): int {
return 70;
}
public function get_type(): string {
return 'archive';
}
public function get_label(): string {
return ucwords( $this->taxonomy->label );
}
public function check( $args = [] ): bool {
$taxonomy = $this->get_name();
$id = (int) $args['id'];
if ( 'category' === $taxonomy ) {
return is_category( $id );
}
if ( 'post_tag' === $taxonomy ) {
return is_tag( $id );
}
return is_tax( $taxonomy, $id );
}
public function get_name(): string {
return $this->taxonomy->name;
}
protected function register_controls() {
$this->add_control( 'taxonomy', [
'field' => 'term_id',
'query_type' => 'taxonomy',
'options' => [ '' => 'All' ],
'query' => [ 'taxonomy' => $this->get_name() ]
] );
}
}