\AddronixAddons\AAFE_Template::CPT, 'posts_per_page' => -1, 'post_status' => [ 'publish', 'draft' ], ] ); $aafe_cpt_counts = wp_count_posts( \AddronixAddons\AAFE_Template::CPT ); $aafe_trash_count = isset( $aafe_cpt_counts->trash ) ? (int) $aafe_cpt_counts->trash : 0; $aafe_counts = [ 'all' => count( $aafe_all_active_templates ), 'header' => 0, 'footer' => 0, 'loop' => 0, 'mega-menu' => 0, 'trash' => $aafe_trash_count, ]; foreach ( $aafe_all_active_templates as $aafe_p ) { $aafe_t_type = get_post_meta( $aafe_p->ID, \AddronixAddons\AAFE_Template::META_TYPE, true ); if ( empty( $aafe_t_type ) ) { $aafe_t_type = get_post_meta( $aafe_p->ID, '_aafe_hf_type', true ); } if ( isset( $aafe_counts[ $aafe_t_type ] ) ) { $aafe_counts[ $aafe_t_type ]++; } } if ( 'trash' === $aafe_current_tab ) { $aafe_templates = get_posts( [ 'post_type' => \AddronixAddons\AAFE_Template::CPT, 'posts_per_page' => -1, 'post_status' => 'trash', ] ); } elseif ( 'all' === $aafe_current_tab ) { $aafe_templates = $aafe_all_active_templates; } else { $aafe_templates = array_filter( $aafe_all_active_templates, function( $aafe_p ) use ( $aafe_current_tab ) { $type = get_post_meta( $aafe_p->ID, \AddronixAddons\AAFE_Template::META_TYPE, true ); if ( empty( $type ) ) { $type = get_post_meta( $aafe_p->ID, '_aafe_hf_type', true ); } return $type === $aafe_current_tab; } ); } $aafe_tabs = [ 'all' => [ 'label' => __( 'All Parts', 'addronix-addons-for-elementor' ), 'count' => $aafe_counts['all'] ], 'header' => [ 'label' => __( 'Header', 'addronix-addons-for-elementor' ), 'count' => $aafe_counts['header'] ], 'footer' => [ 'label' => __( 'Footer', 'addronix-addons-for-elementor' ), 'count' => $aafe_counts['footer'] ], 'loop' => [ 'label' => __( 'Loop Item', 'addronix-addons-for-elementor' ), 'count' => $aafe_counts['loop'] ], 'mega-menu' => [ 'label' => __( 'Mega Menu', 'addronix-addons-for-elementor' ), 'count' => $aafe_counts['mega-menu'] ], ]; if ( $aafe_trash_count > 0 || 'trash' === $aafe_current_tab ) { $aafe_tabs['trash'] = [ 'label' => __( 'Trash', 'addronix-addons-for-elementor' ), 'count' => $aafe_counts['trash'] ]; } $aafe_tab_svgs = [ 'trash' => '', 'all' => '', 'header' => '', 'footer' => '', 'loop' => '', 'mega-menu' => '', ]; $aafe_card_svgs = [ 'header' => '', 'footer' => '', 'loop' => '', 'mega-menu' => '', 'all' => '', ]; ?>

    $aafe_tab_data ) : $aafe_tab_url = add_query_arg( [ 'page' => 'addronix-addons-for-elementor-theme-builder', 'tab' => $aafe_tab_key ], admin_url( 'admin.php' ) ); $aafe_is_active = $aafe_current_tab === $aafe_tab_key; ?>

$aafe_template->ID, 'action' => 'elementor' ], admin_url( 'post.php' ) ); $aafe_type = get_post_meta( $aafe_template->ID, \AddronixAddons\AAFE_Template::META_TYPE, true ); if ( empty( $aafe_type ) ) { $aafe_type = get_post_meta( $aafe_template->ID, '_aafe_hf_type', true ); // Also fix it for the future if ( ! empty( $aafe_type ) ) { update_post_meta( $aafe_template->ID, \AddronixAddons\AAFE_Template::META_TYPE, $aafe_type ); } } $aafe_type_label = isset( $aafe_tabs[ $aafe_type ] ) ? $aafe_tabs[ $aafe_type ]['label'] : ucfirst( $aafe_type ?: __( 'Template', 'addronix-addons-for-elementor' ) ); // Get type SVG icon for the preview banner $aafe_svg_icon = isset( $aafe_card_svgs[ $aafe_type ] ) ? $aafe_card_svgs[ $aafe_type ] : $aafe_card_svgs['all']; // Get conditions for all template types $aafe_conditions = get_post_meta( $aafe_template->ID, '_aafe_hf_conditions', true ); if ( ! is_array( $aafe_conditions ) ) { $aafe_display_on = get_post_meta( $aafe_template->ID, '_aafe_hf_display_on', true ) ?: 'all'; $aafe_singular = get_post_meta( $aafe_template->ID, '_aafe_hf_singular_type', true ) ?: 'all'; $aafe_conditions = [ [ 'type' => 'include', 'display_on' => $aafe_display_on, 'singular_type' => $aafe_singular ] ]; } $aafe_preview = '
' . $aafe_svg_icon . '' . esc_html( $aafe_type_label ) . '
'; ?> post_status; ?>

ID ) ); ?> ID ) ); ?>

post_status ? __( 'Published', 'addronix-addons-for-elementor' ) : __( 'Disabled', 'addronix-addons-for-elementor' ) ) ); ?>