__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Templately\Builder\Conditions;
class Post extends Condition {
private $post_type;
public function __construct( $args = [] ) {
$this->post_type = get_post_type_object( $args['post_type'] );
parent::__construct( $args );
}
public function get_priority(): int {
return 40;
}
public function get_type(): string {
return 'singular';
}
public function get_label(): string {
return $this->post_type->labels->singular_name;
}
public function get_all_label(): string {
return $this->post_type->label;
}
public function get_name(): string {
return $this->post_type->name;
}
public function check( $args = [] ): bool {
if ( isset( $args['id'] ) ) {
$id = (int) $args['id'];
if ( $id ) {
return is_singular() && get_queried_object_id() === $id;
}
}
return is_singular( $this->post_type->name );
}
public function register_sub_conditions() {
// foreach ( $this->post_taxonomies as $slug => $object ) {
// $in_taxonomy = new In_Taxonomy( [
// 'object' => $object,
// ] );
// $this->register_sub_condition( $in_taxonomy );
//
// if ( $object->hierarchical ) {
// $in_sub_term = new In_Sub_Term( [
// 'object' => $object,
// ] );
// $this->register_sub_condition( $in_sub_term );
// }
// }
$by_author = new PostByAuthor( $this->post_type );
$this->register_sub_condition( $by_author );
}
protected function register_controls() {
$this->add_control( "posts_query_" . $this->get_name(), [
'field' => 'ID',
'query_type' => 'posts',
'options' => [ '' => 'All' ],
'query' => [ 'post_type' => $this->get_name() ]
] );
}
}| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Archive.php | File | 1.14 KB | 0640 |
|
| Condition.php | File | 1.76 KB | 0640 |
|
| Error.php | File | 413 B | 0640 |
|
| Front.php | File | 421 B | 0640 |
|
| General.php | File | 451 B | 0640 |
|
| Page.php | File | 1.24 KB | 0640 |
|
| Post.php | File | 1.6 KB | 0640 |
|
| PostByAuthor.php | File | 966 B | 0640 |
|
| PostTypeArchive.php | File | 1.58 KB | 0640 |
|
| ProductSearch.php | File | 418 B | 0640 |
|
| Search.php | File | 414 B | 0640 |
|
| Singular.php | File | 971 B | 0640 |
|
| Taxonomy.php | File | 1.01 KB | 0640 |
|
| WooCommerce.php | File | 731 B | 0640 |
|