Astra_Addon_Update::v_1_4_1()

Update options of older version than 1.4.1


Description

Sticky Header options Primary Menu, Above Header Menu and Below Header menu colors moved into Sticky Header colors

Transparent Header colors options migrate to respective responsive keys

1) Set the new option different-sticky-retina-logo to true for users who are already using a sticky header retina logo. 2) Set the new option different-transparent-retina-logo to true for users who are already using a transparent header retina logo. 3) Set the new option different-retina-logo to true for users who are already using a advanced header retina logo.


Source

File: classes/class-astra-addon-update.php

		public static function v_1_4_1() {
			$astra_options         = get_option( 'astra-settings', array() );
			$sticky_header_opacity = isset( $astra_options['sticky-header-bg-opc'] ) ? $astra_options['sticky-header-bg-opc'] : 1;
			$updated_options       = array(
				'sticky-header-color-site-title-responsive' => array(
					'desktop' => ( isset( $astra_options['header-color-site-title'] ) ) ? $astra_options['header-color-site-title'] : '',
					'tablet'  => '',
					'mobile'  => '',
				),
				'sticky-header-color-site-tagline-responsive' => array(
					'desktop' => ( isset( $astra_options['header-color-h-site-title'] ) ) ? $astra_options['header-color-h-site-title'] : '',
					'tablet'  => '',
					'mobile'  => '',
				),
				'sticky-header-color-h-site-title-responsive' => array(
					'desktop' => ( isset( $astra_options['header-color-site-tagline'] ) ) ? $astra_options['header-color-site-tagline'] : '',
					'tablet'  => '',
					'mobile'  => '',
				),
				'sticky-header-bg-color-responsive'        => array(
					'desktop' => ( ! empty( $astra_options['header-bg-obj-responsive']['desktop']['background'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['header-bg-obj-responsive']['desktop']['background'] ), $sticky_header_opacity ) : astra_hex_to_rgba( '#ffffff', $sticky_header_opacity ),
					'tablet'  => ( ! empty( $astra_options['header-bg-obj-responsive']['tablet']['background'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['header-bg-obj-responsive']['tablet']['background'] ), $sticky_header_opacity ) : '',
					'mobile'  => ( ! empty( $astra_options['header-bg-obj-responsive']['mobile']['background'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['header-bg-obj-responsive']['mobile']['background'] ), $sticky_header_opacity ) : '',
				),
				'sticky-header-menu-bg-color-responsive'   => array(
					'desktop' => ( ! empty( $astra_options['primary-menu-bg-obj-responsive']['desktop']['background-color'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['primary-menu-bg-obj-responsive']['desktop']['background-color'] ), $sticky_header_opacity ) : '',
					'tablet'  => ( ! empty( $astra_options['primary-menu-bg-obj-responsive']['tablet']['background-color'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['primary-menu-bg-obj-responsive']['tablet']['background-color'] ), $sticky_header_opacity ) : '',
					'mobile'  => ( ! empty( $astra_options['primary-menu-bg-obj-responsive']['mobile']['background-color'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['primary-menu-bg-obj-responsive']['mobile']['background-color'] ), $sticky_header_opacity ) : '',
				),
				'sticky-header-menu-color-responsive'      => array(
					'desktop' => ( isset( $astra_options['primary-menu-color-responsive']['desktop'] ) ) ? $astra_options['primary-menu-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['primary-menu-color-responsive']['tablet'] ) ) ? $astra_options['primary-menu-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['primary-menu-color-responsive']['mobile'] ) ) ? $astra_options['primary-menu-color-responsive']['mobile'] : '',
				),
				'sticky-header-menu-h-color-responsive'    => array(
					'desktop' => ( isset( $astra_options['primary-menu-h-color-responsive']['desktop'] ) ) ? $astra_options['primary-menu-h-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['primary-menu-h-color-responsive']['tablet'] ) ) ? $astra_options['primary-menu-h-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['primary-menu-h-color-responsive']['mobile'] ) ) ? $astra_options['primary-menu-h-color-responsive']['mobile'] : '',
				),
				'sticky-header-menu-h-a-bg-color-responsive' => array(
					'desktop' => ( isset( $astra_options['primary-menu-h-bg-color-responsive']['desktop'] ) ) ? $astra_options['primary-menu-h-bg-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['primary-menu-h-bg-color-responsive']['tablet'] ) ) ? $astra_options['primary-menu-h-bg-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['primary-menu-h-bg-color-responsive']['mobile'] ) ) ? $astra_options['primary-menu-h-bg-color-responsive']['mobile'] : '',
				),
				'sticky-header-submenu-bg-color-responsive' => array(
					'desktop' => ( isset( $astra_options['primary-submenu-bg-color-responsive']['desktop'] ) ) ? $astra_options['primary-submenu-bg-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['primary-submenu-bg-color-responsive']['tablet'] ) ) ? $astra_options['primary-submenu-bg-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['primary-submenu-bg-color-responsive']['mobile'] ) ) ? $astra_options['primary-submenu-bg-color-responsive']['mobile'] : '',
				),
				'sticky-header-submenu-color-responsive'   => array(
					'desktop' => ( isset( $astra_options['primary-submenu-color-responsive']['desktop'] ) ) ? $astra_options['primary-submenu-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['primary-submenu-color-responsive']['tablet'] ) ) ? $astra_options['primary-submenu-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['primary-submenu-color-responsive']['mobile'] ) ) ? $astra_options['primary-submenu-color-responsive']['mobile'] : '',
				),
				'sticky-header-submenu-h-color-responsive' => array(
					'desktop' => ( isset( $astra_options['primary-submenu-h-color-responsive']['desktop'] ) ) ? $astra_options['primary-submenu-h-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['primary-submenu-h-color-responsive']['tablet'] ) ) ? $astra_options['primary-submenu-h-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['primary-submenu-h-color-responsive']['mobile'] ) ) ? $astra_options['primary-submenu-h-color-responsive']['mobile'] : '',
				),
				'sticky-header-submenu-h-a-bg-color-responsive' => array(
					'desktop' => ( isset( $astra_options['primary-submenu-h-bg-color-responsive']['desktop'] ) ) ? $astra_options['primary-submenu-h-bg-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['primary-submenu-h-bg-color-responsive']['tablet'] ) ) ? $astra_options['primary-submenu-h-bg-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['primary-submenu-h-bg-color-responsive']['mobile'] ) ) ? $astra_options['primary-submenu-h-bg-color-responsive']['mobile'] : '',
				),

				// Below header.
				'sticky-below-header-bg-color-responsive'  => array(
					'desktop' => ( ! empty( $astra_options['below-header-bg-obj-responsive']['desktop']['background'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['below-header-bg-obj-responsive']['desktop']['background'] ), $sticky_header_opacity ) : astra_hex_to_rgba( '#414042', $sticky_header_opacity ),
					'tablet'  => ( ! empty( $astra_options['below-header-bg-obj-responsive']['tablet']['background'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['below-header-bg-obj-responsive']['tablet']['background'] ), $sticky_header_opacity ) : '',
					'mobile'  => ( ! empty( $astra_options['below-header-bg-obj-responsive']['mobile']['background'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['below-header-bg-obj-responsive']['mobile']['background'] ), $sticky_header_opacity ) : '',
				),
				'sticky-below-header-menu-bg-color-responsive' => array(
					'desktop' => ( ! empty( $astra_options['below-header-menu-bg-obj-responsive']['desktop']['background-color'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['below-header-menu-bg-obj-responsive']['desktop']['background-color'] ), $sticky_header_opacity ) : '',
					'tablet'  => ( ! empty( $astra_options['below-header-menu-bg-obj-responsive']['tablet']['background-color'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['below-header-menu-bg-obj-responsive']['tablet']['background-color'] ), $sticky_header_opacity ) : '',
					'mobile'  => ( ! empty( $astra_options['below-header-menu-bg-obj-responsive']['mobile']['background-color'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['below-header-menu-bg-obj-responsive']['mobile']['background-color'] ), $sticky_header_opacity ) : '',
				),
				'sticky-below-header-menu-color-responsive' => array(
					'desktop' => ( isset( $astra_options['below-header-menu-text-color-responsive']['desktop'] ) ) ? $astra_options['below-header-menu-text-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['below-header-menu-text-color-responsive']['tablet'] ) ) ? $astra_options['below-header-menu-text-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['below-header-menu-text-color-responsive']['mobile'] ) ) ? $astra_options['below-header-menu-text-color-responsive']['mobile'] : '',
				),
				'sticky-below-header-menu-h-color-responsive' => array(
					'desktop' => ( isset( $astra_options['below-header-menu-text-hover-color-responsive']['desktop'] ) ) ? $astra_options['below-header-menu-text-hover-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['below-header-menu-text-hover-color-responsive']['tablet'] ) ) ? $astra_options['below-header-menu-text-hover-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['below-header-menu-text-hover-color-responsive']['mobile'] ) ) ? $astra_options['below-header-menu-text-hover-color-responsive']['mobile'] : '',
				),
				'sticky-below-header-menu-h-a-bg-color-responsive' => array(
					'desktop' => ( isset( $astra_options['below-header-menu-bg-hover-color-responsive']['desktop'] ) ) ? $astra_options['below-header-menu-bg-hover-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['below-header-menu-bg-hover-color-responsive']['tablet'] ) ) ? $astra_options['below-header-menu-bg-hover-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['below-header-menu-bg-hover-color-responsive']['mobile'] ) ) ? $astra_options['below-header-menu-bg-hover-color-responsive']['mobile'] : '',
				),
				'sticky-below-header-submenu-bg-color-responsive' => array(
					'desktop' => ( isset( $astra_options['below-header-submenu-bg-color-responsive']['desktop'] ) ) ? $astra_options['below-header-submenu-bg-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['below-header-submenu-bg-color-responsive']['tablet'] ) ) ? $astra_options['below-header-submenu-bg-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['below-header-submenu-bg-color-responsive']['mobile'] ) ) ? $astra_options['below-header-submenu-bg-color-responsive']['mobile'] : '',
				),
				'sticky-below-header-submenu-color-responsive' => array(
					'desktop' => ( isset( $astra_options['below-header-submenu-text-color-responsive']['desktop'] ) ) ? $astra_options['below-header-submenu-text-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['below-header-submenu-text-color-responsive']['tablet'] ) ) ? $astra_options['below-header-submenu-text-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['below-header-submenu-text-color-responsive']['mobile'] ) ) ? $astra_options['below-header-submenu-text-color-responsive']['mobile'] : '',
				),
				'sticky-below-header-submenu-h-color-responsive' => array(
					'desktop' => ( isset( $astra_options['below-header-submenu-hover-color-responsive']['desktop'] ) ) ? $astra_options['below-header-submenu-hover-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['below-header-submenu-hover-color-responsive']['tablet'] ) ) ? $astra_options['below-header-submenu-hover-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['below-header-submenu-hover-color-responsive']['mobile'] ) ) ? $astra_options['below-header-submenu-hover-color-responsive']['mobile'] : '',
				),
				'sticky-below-header-submenu-h-a-bg-color-responsive' => array(
					'desktop' => ( isset( $astra_options['below-header-submenu-bg-hover-color-responsive']['desktop'] ) ) ? $astra_options['below-header-submenu-bg-hover-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['below-header-submenu-bg-hover-color-responsive']['tablet'] ) ) ? $astra_options['below-header-submenu-bg-hover-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['below-header-submenu-bg-hover-color-responsive']['mobile'] ) ) ? $astra_options['below-header-submenu-bg-hover-color-responsive']['mobile'] : '',
				),

				// Above header.
				'sticky-above-header-bg-color-responsive'  => array(
					'desktop' => ( ! empty( $astra_options['above-header-bg-obj-responsive']['desktop']['background'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['above-header-bg-obj-responsive']['desktop']['background'] ), $sticky_header_opacity ) : astra_hex_to_rgba( '#ffffff', $sticky_header_opacity ),
					'tablet'  => ( ! empty( $astra_options['above-header-bg-obj-responsive']['tablet']['background'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['above-header-bg-obj-responsive']['tablet']['background'] ), $sticky_header_opacity ) : '',
					'mobile'  => ( ! empty( $astra_options['above-header-bg-obj-responsive']['mobile']['background'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['above-header-bg-obj-responsive']['mobile']['background'] ), $sticky_header_opacity ) : '',
				),
				'sticky-above-header-menu-bg-color-responsive' => array(
					'desktop' => ( ! empty( $astra_options['above-header-menu-bg-obj-responsive']['desktop']['background-color'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['above-header-menu-bg-obj-responsive']['desktop']['background-color'] ), $sticky_header_opacity ) : '',
					'tablet'  => ( ! empty( $astra_options['above-header-menu-bg-obj-responsive']['tablet']['background-color'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['above-header-menu-bg-obj-responsive']['tablet']['background-color'] ), $sticky_header_opacity ) : '',
					'mobile'  => ( ! empty( $astra_options['above-header-menu-bg-obj-responsive']['mobile']['background-color'] ) ) ? astra_hex_to_rgba( astra_rgba2hex( $astra_options['above-header-menu-bg-obj-responsive']['mobile']['background-color'] ), $sticky_header_opacity ) : '',
				),
				'sticky-above-header-menu-color-responsive' => array(
					'desktop' => ( isset( $astra_options['above-header-menu-color-responsive']['desktop'] ) ) ? $astra_options['above-header-menu-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['above-header-menu-color-responsive']['tablet'] ) ) ? $astra_options['above-header-menu-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['above-header-menu-color-responsive']['mobile'] ) ) ? $astra_options['above-header-menu-color-responsive']['mobile'] : '',
				),
				'sticky-above-header-menu-h-color-responsive' => array(
					'desktop' => ( isset( $astra_options['above-header-menu-h-color-responsive']['desktop'] ) ) ? $astra_options['above-header-menu-h-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['above-header-menu-h-color-responsive']['tablet'] ) ) ? $astra_options['above-header-menu-h-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['above-header-menu-h-color-responsive']['mobile'] ) ) ? $astra_options['above-header-menu-h-color-responsive']['mobile'] : '',
				),
				'sticky-above-header-menu-h-a-bg-color-responsive' => array(
					'desktop' => ( isset( $astra_options['above-header-menu-h-bg-color-responsive']['desktop'] ) ) ? $astra_options['above-header-menu-h-bg-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['above-header-menu-h-bg-color-responsive']['tablet'] ) ) ? $astra_options['above-header-menu-h-bg-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['above-header-menu-h-bg-color-responsive']['mobile'] ) ) ? $astra_options['above-header-menu-h-bg-color-responsive']['mobile'] : '',
				),
				'sticky-above-header-submenu-bg-color-responsive' => array(
					'desktop' => ( isset( $astra_options['above-header-submenu-bg-color-responsive']['desktop'] ) ) ? $astra_options['above-header-submenu-bg-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['above-header-submenu-bg-color-responsive']['tablet'] ) ) ? $astra_options['above-header-submenu-bg-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['above-header-submenu-bg-color-responsive']['mobile'] ) ) ? $astra_options['above-header-submenu-bg-color-responsive']['mobile'] : '',
				),
				'sticky-above-header-submenu-color-responsive' => array(
					'desktop' => ( isset( $astra_options['above-header-submenu-text-color-responsive']['desktop'] ) ) ? $astra_options['above-header-submenu-text-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['above-header-submenu-text-color-responsive']['tablet'] ) ) ? $astra_options['above-header-submenu-text-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['above-header-submenu-text-color-responsive']['mobile'] ) ) ? $astra_options['above-header-submenu-text-color-responsive']['mobile'] : '',
				),
				'sticky-above-header-submenu-h-color-responsive' => array(
					'desktop' => ( isset( $astra_options['above-header-submenu-hover-color-responsive']['desktop'] ) ) ? $astra_options['above-header-submenu-hover-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['above-header-submenu-hover-color-responsive']['tablet'] ) ) ? $astra_options['above-header-submenu-hover-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['above-header-submenu-hover-color-responsive']['mobile'] ) ) ? $astra_options['above-header-submenu-hover-color-responsive']['mobile'] : '',
				),
				'sticky-above-header-submenu-h-a-bg-color-responsive' => array(
					'desktop' => ( isset( $astra_options['above-header-submenu-bg-hover-color-responsive']['desktop'] ) ) ? $astra_options['above-header-submenu-bg-hover-color-responsive']['desktop'] : '',
					'tablet'  => ( isset( $astra_options['above-header-submenu-bg-hover-color-responsive']['tablet'] ) ) ? $astra_options['above-header-submenu-bg-hover-color-responsive']['tablet'] : '',
					'mobile'  => ( isset( $astra_options['above-header-submenu-bg-hover-color-responsive']['mobile'] ) ) ? $astra_options['above-header-submenu-bg-hover-color-responsive']['mobile'] : '',
				),
				// Transparent Header Colors.
				'transparent-header-bg-color-responsive'   => array(
					'desktop' => ( isset( $astra_options['transparent-header-bg-color'] ) ? $astra_options['transparent-header-bg-color'] : '' ),
					'tablet'  => '',
					'mobile'  => '',
				),
				'transparent-header-color-site-title-responsive' => array(
					'desktop' => isset( $astra_options['transparent-header-color-site-title'] ) ? $astra_options['transparent-header-color-site-title'] : '',
					'tablet'  => '',
					'mobile'  => '',
				),
				'transparent-header-color-h-site-title-responsive' => array(
					'desktop' => isset( $astra_options['transparent-header-color-h-site-title'] ) ? $astra_options['transparent-header-color-h-site-title'] : '',
					'tablet'  => '',
					'mobile'  => '',
				),
				'transparent-menu-bg-color-responsive'     => array(
					'desktop' => isset( $astra_options['transparent-menu-bg-color'] ) ? $astra_options['transparent-menu-bg-color'] : '',
					'tablet'  => '',
					'mobile'  => '',
				),
				'transparent-menu-color-responsive'        => array(
					'desktop' => isset( $astra_options['transparent-menu-color'] ) ? $astra_options['transparent-menu-color'] : '',
					'tablet'  => '',
					'mobile'  => '',
				),
				'transparent-menu-h-color-responsive'      => array(
					'desktop' => isset( $astra_options['transparent-menu-h-color'] ) ? $astra_options['transparent-menu-h-color'] : '',
					'tablet'  => '',
					'mobile'  => '',
				),
				'different-sticky-retina-logo'             => ( isset( $astra_options['sticky-header-retina-logo'] ) && '' != $astra_options['sticky-header-retina-logo'] ) ? '1' : false,
				'different-transparent-retina-logo'        => ( isset( $astra_options['transparent-header-retina-logo'] ) && '' != $astra_options['transparent-header-retina-logo'] ) ? '1' : false,

			);

			// Merge customizer options with old options.
			$astra_options = wp_parse_args( $updated_options, $astra_options );
			update_option( 'astra-settings', $astra_options );

			// Page Header different retina logo.
			$args = array(
				'post_type'      => 'astra_adv_header',

				// Query performance optimization.
				'fields'         => 'ids',
				'no_found_rows'  => true,
				'post_status'    => 'any',
				'posts_per_page' => 200, // phpcs:ignore WordPress.WP.PostsPerPage.posts_per_page_posts_per_page

			);

			$query = new WP_Query( $args );

			$post_ids = (array) $query->posts;
			foreach ( $post_ids as $key => $post_id ) {

				$ast_advanced_headers_design = get_post_meta( $post_id, 'ast-advanced-headers-design', true );

				if ( '' !== $ast_advanced_headers_design['retina-logo-url'] ) {

					$ast_advanced_headers_layout                            = get_post_meta( $post_id, 'ast-advanced-headers-layout', true );
					$ast_advanced_headers_layout['diff-header-retina-logo'] = 'enabled';

					update_post_meta( $post_id, 'ast-advanced-headers-layout', $ast_advanced_headers_layout );
				}
			}

		}

Changelog

Changelog
Version Description
1.4.1 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.