PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 4.0.2
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v4.0.2
4.0.2 4.0.1 4.0.0 3.10.02 3.10.01 3.9.10 3.9.9 3.9.8 3.9.7 3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.3.1 2.3.1.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.4.0 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.2 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.6.0 3.6.1 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.9.0 3.9.1 3.9.2 trunk 1.2.6 1.2.7 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.0.9.1 2.0.9.2 2.0.9.3
elementskit-lite / modules / header-footer / cpt-hooks.php
elementskit-lite / modules / header-footer Last commit date
assets 1 week ago theme-hooks 4 years ago views 1 week ago activator.php 2 years ago cpt-api.php 4 years ago cpt-hooks.php 2 years ago cpt.php 1 year ago init.php 1 week ago
cpt-hooks.php
116 lines
1 <?php
2 namespace ElementsKit_Lite\Modules\Header_Footer;
3
4 defined( 'ABSPATH' ) || exit;
5
6 class Cpt_Hooks {
7 public static $instance = null;
8
9 public function __construct() {
10
11 add_action( 'admin_init', array( $this, 'add_author_support_to_column' ), 10 );
12 add_filter( 'manage_elementskit_template_posts_columns', array( $this, 'set_columns' ) );
13 add_action( 'manage_elementskit_template_posts_custom_column', array( $this, 'render_column' ), 10, 2 );
14 add_filter( 'parse_query', array( $this, 'query_filter' ) );
15 }
16
17 public function add_author_support_to_column() {
18 add_post_type_support( 'elementskit_template', 'author' );
19 }
20
21 /**
22 * Set custom column for template list.
23 */
24 public function set_columns( $columns ) {
25
26 $date_column = $columns['date'];
27 $author_column = $columns['author'];
28
29 unset( $columns['date'] );
30 unset( $columns['author'] );
31
32 $columns['type'] = esc_html__( 'Type', 'elementskit-lite' );
33 $columns['condition'] = esc_html__( 'Conditions', 'elementskit-lite' );
34 $columns['date'] = $date_column;
35 $columns['author'] = $author_column;
36
37 return $columns;
38 }
39
40 /**
41 * Render Column
42 *
43 * Enqueue js and css to frontend.
44 *
45 * @since 1.0.0
46 * @access public
47 */
48 public function render_column( $column, $post_id ) {
49 switch ( $column ) {
50 case 'type':
51 $type = get_post_meta( $post_id, 'elementskit_template_type', true );
52 $active = get_post_meta( $post_id, 'elementskit_template_activation', true );
53
54 $output = ucfirst( $type ) . ( ( $active == 'yes' )
55 ? ( '<span class="ekit-headerfooter-status ekit-headerfooter-status-active">' . esc_html__( 'Active', 'elementskit-lite' ) . '</span>' )
56 : ( '<span class="ekit-headerfooter-status ekit-headerfooter-status-inactive">' . esc_html__( 'Inactive', 'elementskit-lite' ) . '</span>' ) );
57
58 echo wp_kses($output, \ElementsKit_Lite\Utils::get_kses_array());
59
60 break;
61 case 'condition':
62 $cond = array(
63 'condition_a' => get_post_meta( $post_id, 'elementskit_template_condition_a', true ),
64 'condition_singular' => get_post_meta( $post_id, 'elementskit_template_condition_singular', true ),
65 'condition_singular_id' => get_post_meta( $post_id, 'elementskit_template_condition_singular_id', true ),
66 );
67
68 echo esc_html(ucwords(
69 str_replace(
70 '_',
71 ' ',
72 $cond['condition_a']
73 . ( ( $cond['condition_a'] == 'singular' )
74 ? ( ( $cond['condition_singular'] != '' )
75 ? ( ' > ' . $cond['condition_singular']
76 . ( ( $cond['condition_singular_id'] != '' )
77 ? ' > ' . $cond['condition_singular_id']
78 : '' ) )
79 : '' )
80 : '' )
81 )
82 ));
83
84 break;
85 }
86 }
87
88
89 public function query_filter( $query ) {
90 global $pagenow;
91 $current_page = isset( $_GET['post_type'] ) ? sanitize_text_field(wp_unslash($_GET['post_type'])) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are using wordpress default query filter for managing menu items
92
93 if ( is_admin()
94 && 'elementskit_template' == $current_page
95 && 'edit.php' == $pagenow
96 && isset( $_GET['elementskit_type_filter'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are using wordpress default query filter for managing menu items
97 && $_GET['elementskit_type_filter'] != '' // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are using wordpress default query filter for managing menu items
98 && $_GET['elementskit_type_filter'] != 'all' // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are using wordpress default query filter for managing menu items
99 ) {
100 $type = sanitize_text_field(wp_unslash($_GET['elementskit_type_filter'])); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- We are using wordpress default query filter for managing menu items
101 $query->query_vars['meta_key'] = 'elementskit_template_type'; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
102 $query->query_vars['meta_value'] = $type; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value
103 $query->query_vars['meta_compare'] = '=';
104 }
105 }
106
107
108 public static function instance() {
109 if ( is_null( self::$instance ) ) {
110 self::$instance = new self();
111 }
112
113 return self::$instance;
114 }
115 }
116