PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.0.2
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.0.2
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
templately / includes / Builder / Conditions / Singular.php

Singular.php in Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! 3.0.2, at includes/Builder/Conditions/Singular.php

50 lines 961 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Templately\Builder\Conditions;
4
5 class Singular extends Condition {
6 protected $sub_conditions = [
7 'front',
8 'error'
9 ];
10
11 public function get_type(): string {
12 return 'singular';
13 }
14
15 public function get_priority(): int {
16 return 60;
17 }
18
19 public function get_label(): string {
20 return __( 'Singular', 'templately' );
21 }
22
23 public function get_all_label(): string {
24 return __( 'All Singular', 'templately' );
25 }
26
27 public function get_name(): string {
28 return 'singular';
29 }
30
31 public function check( $args = [] ): bool {
32 return ( is_singular() && ! is_embed() ) || is_404();
33 }
34
35 protected function register_sub_conditions() {
36 $post_types = $this->builder->get_public_post_types();
37
38 foreach ( $post_types as $post_type => $label ) {
39 if ( ! get_post_type_archive_link( $post_type ) ) {
40 continue;
41 }
42
43 $condition = new Post( [
44 'post_type' => $post_type,
45 ] );
46
47 $this->register_sub_condition( $condition );
48 }
49 }
50 }