Astra_Ext_Advanced_Headers_Meta::markup_meta_box( object $post )
Metabox Markup
Description
Parameters
- $post
-
(object) (Required) Post object.
Return
(void)
Source
File: addons/advanced-headers/classes/class-astra-ext-advanced-headers-meta.php
public function markup_meta_box( $post ) { wp_nonce_field( basename( __FILE__ ), 'astra-advanced-headers' ); $stored = get_post_meta( $post->ID ); $advanced_headers_meta = array( 'ast-advanced-headers-layout', 'ast-advanced-headers-design', 'ast-advanced-headers-location', 'ast-advanced-headers-exclusion', 'ast-advanced-headers-users', ); // Set stored and override defaults. foreach ( $stored as $key => $value ) { if ( in_array( $key, $advanced_headers_meta ) ) { self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? maybe_unserialize( $stored[ $key ][0] ) : ''; } else { self::$meta_option[ $key ]['default'] = ( isset( $stored[ $key ][0] ) ) ? $stored[ $key ][0] : ''; } } // Get defaults. $meta = self::get_meta_option(); $default_above_header = $this->get_default_header_sections( 'above-header-layout' ); $default_below_header = $this->get_default_header_sections( 'below-header-layout' ); /** * Get options */ $ast_advanced_headers_layout = ( isset( $meta['ast-advanced-headers-layout']['default'] ) ) ? $meta['ast-advanced-headers-layout']['default'] : array( 'layout' => 'advanced-headers-layout-2', 'breadcrumb' => '', 'force-transparent-disabled' => 'yes', 'above-header-enabled' => $default_above_header, 'below-header-enabled' => $default_below_header, ); $ast_advanced_headers_design = ( isset( $meta['ast-advanced-headers-design']['default'] ) ) ? $meta['ast-advanced-headers-design']['default'] : array( 'title-color' => '#ffffff', 'b-text-color' => '', 'b-link-color' => '', 'b-link-hover-color' => '', 'background-color' => 'rgba(44,62,80,0.50)', 'bg-image-id' => '', 'bg-image' => '', 'page-post-featured' => 'enabled', 'logo-id' => '', 'logo-url' => '', 'retina-logo-id' => '', 'retina-logo-url' => '', 'header-logo-width' => '', 'header-bg-color' => '', 'site-title-color' => '', 'site-title-h-color' => '', 'site-tagline-color' => '', 'primary-menu-bg-color' => '', 'primary-menu-color' => '', 'primary-menu-h-color' => '', 'primary-menu-a-color' => '', 'primary-submenu-bg-color' => '', 'primary-submenu-color' => '', 'primary-submenu-h-color' => '', 'primary-submenu-a-color' => '', 'above-header-bg-color' => '', 'above-header-text-link-color' => '', 'above-header-h-color' => '', 'above-header-a-color' => '', 'above-header-submenu-bg-color' => '', 'above-header-submenu-link-color' => '', 'above-header-submenu-h-color' => '', 'above-header-submenu-a-color' => '', 'below-header-bg-color' => '', 'below-header-text-link-color' => '', 'below-header-h-color' => '', 'below-header-a-color' => '', 'below-header-submenu-bg-color'=> '', 'below-header-submenu-link-color' => '', 'below-header-submenu-h-color' => '', 'below-header-submenu-a-color' => '', 'header-main-sep' => '', 'header-main-sep-color' => '', 'bg-size' => 'custom-bg-size', 'bg-custom-size-top-padding' => '5', 'bg-custom-size-bottom-padding' => '5', 'parallax-device' => 'none', 'overlay-bg-color' => '', 'custom-menu' => '', 'custom-menu-item' => 'default', 'custom-menu-item-outside' => '', 'custom-menu-item-text-html' => '', 'search-style' => 'default', ); $display_locations = ( isset( $meta['ast-advanced-headers-location']['default'] ) ) ? $meta['ast-advanced-headers-location']['default'] : ''; $exclude_locations = ( isset( $meta['ast-advanced-headers-exclusion']['default'] ) ) ? $meta['ast-advanced-headers-exclusion']['default'] : ''; $user_roles = ( isset( $meta['ast-advanced-headers-users']['default'] ) ) ? $meta['ast-advanced-headers-users']['default'] : ''; // settings added after published/updated the meta. $unsaved_array = array(); $independent_addon_array = array( 'site-title-color' => '', 'site-title-h-color' => '', 'site-tagline-color' => '', 'above-header-bg-color' => '', 'above-header-text-link-color' => '', 'above-header-h-color' => '', 'above-header-a-color' => '', 'above-header-submenu-bg-color' => '', 'above-header-submenu-link-color' => '', 'above-header-submenu-h-color' => '', 'above-header-submenu-a-color' => '', 'below-header-bg-color' => '', 'below-header-text-link-color' => '', 'below-header-h-color' => '', 'below-header-a-color' => '', 'below-header-submenu-bg-color'=> '', 'below-header-submenu-link-color' => '', 'below-header-submenu-h-color' => '', 'below-header-submenu-a-color' => '', 'custom-menu-item' => '', ); foreach ( $independent_addon_array as $key => $value ) { // key not exist then set a key to existing unsaved array. if ( ! isset( $ast_advanced_headers_design[ $key ] ) ) { $unsaved_array[ $key ] = $value; } } // Merge array if new key added after updated/published. $ast_advanced_headers_design = array_merge( $ast_advanced_headers_design, $unsaved_array ); $ast_advanced_headers = array( 'layouts' => $ast_advanced_headers_layout, 'designs' => $ast_advanced_headers_design, 'include_locations' => $display_locations, 'exclude_locations' => $exclude_locations, 'user_roles' => $user_roles, ); do_action( 'astra_advanced_headers_settings_markup_before', $meta ); ?> <!-- Advanced Headers Tabs --> <div id="ast-advanced-headers-tabs"> <div class="nav-tab-wrapper"> <ul> <?php $actions = array( 'page-header' => array( 'label' => __( 'Page Header', 'astra-addon' ), 'show' => ! is_network_admin(), ), 'site-header' => array( 'label' => __( 'Site Header', 'astra-addon' ), 'show' => ! is_network_admin(), ), 'display-rules' => array( 'label' => __( 'Display Rules', 'astra-addon' ), 'show' => ! is_network_admin(), ), ); $view_actions = apply_filters( 'astra_adv_headers_tab_options', $actions ); $count = 0; foreach ( $view_actions as $slug => $data ) { if ( ! $data['show'] ) { continue; } $class = ''; $current_tab = isset( $_GET['current-tab'] ) ? esc_attr( $_GET['current-tab'] ) : ''; if ( '' != $current_tab && 'ast-adv-headers-tab-' . esc_attr( $slug ) == $current_tab ) { $class = 'nav-tab-active'; } elseif ( '' == $current_tab && esc_attr( $slug ) == 'page-header' ) { $class = 'nav-tab-active'; } ?> <li><a class='nav-tab <?php echo esc_attr( $class ); ?>' href='#ast-adv-headers-<?php echo esc_attr( $slug ); ?>' id='ast-adv-headers-tab-<?php echo esc_attr( $slug ); ?>'> <?php echo esc_html( $data['label'] ); ?> </a> </li> <?php $count ++; } ?> </ul> </div><!-- .nav-tab-wrapper --> <?php $count = 0; foreach ( $view_actions as $slug => $data ) { if ( ! $data['show'] ) { continue; } $class = ''; if ( '' != $current_tab && 'ast-adv-headers-tab-' . esc_attr( $slug ) == $current_tab ) { $class = 'tab-active'; } elseif ( '' == $current_tab && esc_attr( $slug ) == 'page-header' ) { $class = 'tab-active'; } ?> <div id='ast-adv-headers-<?php echo esc_attr( $slug ); ?>' class="ast-adv-headers-tabs-section <?php echo esc_attr( $class ); ?>" > <!-- Advanced Headers Tabs --> <?php do_action( 'astra_adv_headers_tabs_' . esc_attr( $slug ) . '_action', $ast_advanced_headers ); ?> </div> <?php $count ++; } ?> </div> <!-- #ast-advanced-headers-tabs --> <?php do_action( 'astra_advanced_headers_settings_markup_after', $meta ); }
Expand full source code Collapse full source code View on Trac