Astra_Ext_Advanced_Hooks_Meta::page_header_tab( array $options )

Page Header Tabs


Description


Parameters

$options

(array) (Required) Post meta.


Source

File: addons/advanced-hooks/classes/class-astra-ext-advanced-hooks-meta.php

		public function page_header_tab( $options ) {
			// Load Target Rule assets.
			Astra_Target_Rules_Fields::get_instance()->admin_styles();

			$include_locations = $options['include-locations'];
			$exclude_locations = $options['exclude-locations'];
			$users             = $options['user_roles'];
			$padding           = $options['padding'];
			$header            = $options['header'];
			$footer            = $options['footer'];
			$content           = $options['content'];
			$layout_404        = $options['layout-404'];
			$display_devices   = $options['display-devices'];
			$time_duration     = $options['time-duration'];

			$padding_top           = isset( $padding['top'] ) ? $padding['top'] : '';
			$padding_bottom        = isset( $padding['bottom'] ) ? $padding['bottom'] : '';
			$header_sticky         = isset( $header['sticky'] ) ? $header['sticky'] : '';
			$header_shrink         = isset( $header['shrink'] ) ? $header['shrink'] : '';
			$header_on_devices     = isset( $header['sticky-header-on-devices'] ) ? $header['sticky-header-on-devices'] : '';
			$footer_sticky         = isset( $footer['sticky'] ) ? $footer['sticky'] : '';
			$footer_on_devices     = isset( $footer['sticky-footer-on-devices'] ) ? $footer['sticky-footer-on-devices'] : '';
			$disable_header        = isset( $layout_404['disable_header'] ) ? $layout_404['disable_header'] : '';
			$disable_footer        = isset( $layout_404['disable_footer'] ) ? $layout_404['disable_footer'] : '';
			$content_location      = isset( $content['location'] ) ? $content['location'] : '';
			$after_blocks_number   = isset( $content['after_block_number'] ) ? $content['after_block_number'] : '';
			$before_heading_number = isset( $content['before_heading_number'] ) ? $content['before_heading_number'] : '';
			?>
			<table class="ast-advanced-hook-table widefat">

				<tr class="ast-advanced-hook-row">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Layout', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">
						<select id="ast-advanced-hook-layout" name="ast-advanced-hook-layout" style="width: 50%;" >
							<option value="0"><?php printf( '&mdash; %s &mdash;', esc_html__( 'Select', 'astra-addon' ) ); ?></option>
							<?php if ( is_array( self::$layouts ) && ! empty( self::$layouts ) ) : ?>
								<?php foreach ( self::$layouts as $key => $layout ) : ?>

									<option <?php selected( $key, $options['layout'] ); ?> value="<?php echo esc_attr( $key ); ?>" ><?php echo esc_html( $layout['title'] ); ?></option>

								<?php endforeach; ?>
							<?php endif; ?>
						</select>
						<p class="ast-inside-content-notice"><?php esc_html_e( 'This option will be applicable only for the posts/pages created with the block editor.', 'astra-addon' ); ?></p>
					</td>
				</tr>

				<!-- 404 Layout -->
				<tr class="ast-advanced-hook-row ast-404-layout-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Disable Primary Header', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">
					<input type="checkbox" name="ast-404-page[disable_header]"
								value="enabled" <?php checked( $disable_header, 'enabled' ); ?> />
					</td>
				</tr>

				<tr class="ast-advanced-hook-row ast-404-layout-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Disable Footer Bar', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">
					<input type="checkbox" name="ast-404-page[disable_footer]"
								value="enabled" <?php checked( $disable_footer, 'enabled' ); ?> />
					</td>
				</tr>

				<tr class="ast-advanced-hook-row ast-layout-content-location-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Location on post/page', 'astra-addon' ); ?></label>
						<i class="ast-advanced-hook-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'Layout will be inserted at a selected location on page/post in the block editor.', 'astra-addon' ); ?>"></i>
					</td>
					<td class="ast-advanced-hook-row-content">
					<select id="ast-advanced-hook-content-location" name="ast-advanced-hook-content[location]" style="width: 50%;" >
						<option value="<?php echo esc_attr( 'after_blocks' ); ?>" <?php selected( 'after_blocks', $content_location, true ); ?> ><?php esc_html_e( 'After certain number of blocks', 'astra-addon' ); ?></option>
						<option value="<?php echo esc_attr( 'before_headings' ); ?>" <?php selected( 'before_headings', $content_location, true ); ?>><?php esc_html_e( 'Before certain number of Heading blocks', 'astra-addon' ); ?></option>
					</select>
					</td>
				</tr>
				<tr class="ast-advanced-hook-row ast-layout-content-after-blocks">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Block Number', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">
						<span class="ast-advanced-hook-inline-label"><?php esc_attr_e( 'Add layout after', 'astra-addon' ); ?></span>
						<input type="number" class="ast-inside-content-number-field" name="ast-advanced-hook-content[after_block_number]"  min="1" oninput="validity.valid||(value='');" value="<?php echo esc_attr( $after_blocks_number ); ?>" >
						<span class="ast-advanced-hook-inline-label"><?php esc_attr_e( 'Block(s)', 'astra-addon' ); ?></span>
						<p class="ast-inside-content-blocks-notice"><?php esc_attr_e( 'Layout will be inserted after the selected number of blocks. Example - If you set it 3, the layout will be added after the first 3 blocks.', 'astra-addon' ); ?></p>
					</td>
				</tr>
				<tr class="ast-advanced-hook-row ast-layout-content-before-heading">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Heading Block Number', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">
						<span class="ast-advanced-hook-inline-label"><?php esc_attr_e( 'Add content before', 'astra-addon' ); ?></span>
						<input type="number" class="ast-inside-content-number-field" name="ast-advanced-hook-content[before_heading_number]"  min="1" oninput="validity.valid||(value='');" value="<?php echo esc_attr( $before_heading_number ); ?>" >
						<span class="ast-advanced-hook-inline-label"><?php esc_attr_e( 'Heading Block(s)', 'astra-addon' ); ?></span>
						<p class="ast-inside-content-heading-notice"><?php esc_attr_e( 'Layout will be inserted before the selected number of Heading blocks. Example - If you set it 3, the layout will be added just before 3rd Heading block on page.', 'astra-addon' ); ?></p>
					</td>
				</tr>

				<!-- Header Layout -->
				<!-- Sticky Header -->
				<tr class="ast-advanced-hook-row ast-layout-header-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Stick', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">
					<input type="checkbox" name="ast-advanced-hook-header[sticky]"
								value="enabled" <?php checked( $header_sticky, 'enabled' ); ?> />
					</td>
				</tr>
				<!-- Shrink Header -->
				<tr class="ast-advanced-hook-row ast-layout-header-sticky-required ast-layout-header-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Shrink', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">
					<input type="checkbox" name="ast-advanced-hook-header[shrink]"
							value="enabled" <?php checked( $header_shrink, 'enabled' ); ?> />
					</td>
				</tr>
				<!-- Display On -->
				<tr class="ast-advanced-hook-row ast-layout-header-sticky-required ast-layout-header-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Stick On', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">

						<select name="ast-advanced-hook-header[sticky-header-on-devices]" style="width:50%;">
							<option value="desktop"><?php esc_html_e( 'Desktop', 'astra-addon' ); ?></option>
							<option value="mobile" <?php selected( $header_on_devices, 'mobile' ); ?> > <?php esc_html_e( 'Mobile', 'astra-addon' ); ?></option>
							<option value="both" <?php selected( $header_on_devices, 'both' ); ?> > <?php esc_html_e( 'Desktop + Mobile', 'astra-addon' ); ?></option>
						</select>
					</td>
				</tr>

				<!-- Footer Layout -->
				<!-- Sticky Footer -->
				<tr class="ast-advanced-hook-row ast-layout-footer-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Stick', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">
					<input type="checkbox" name="ast-advanced-hook-footer[sticky]"
								value="enabled" <?php checked( $footer_sticky, 'enabled' ); ?> />
					</td>
				</tr>
				<!-- Display On -->
				<tr class="ast-advanced-hook-row ast-layout-footer-sticky-required ast-layout-footer-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Stick On', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">

						<select name="ast-advanced-hook-footer[sticky-footer-on-devices]" style="width:50%;">
							<option value="desktop"><?php esc_html_e( 'Desktop', 'astra-addon' ); ?></option>
							<option value="mobile" <?php selected( $footer_on_devices, 'mobile' ); ?> > <?php esc_html_e( 'Mobile', 'astra-addon' ); ?></option>
							<option value="both" <?php selected( $footer_on_devices, 'both' ); ?> > <?php esc_html_e( 'Desktop + Mobile', 'astra-addon' ); ?></option>
						</select>
					</td>
				</tr>


				<tr class="ast-advanced-hook-row ast-layout-hooks-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Action', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">
						<?php
						$description = '';
						?>
						<select id="ast-advanced-hook-action" name="ast-advanced-hook-action" style="width: 50%;" >
							<option value="0"><?php printf( '&mdash; %s &mdash;', esc_html__( 'Select', 'astra-addon' ) ); ?></option>
							<?php if ( is_array( self::$hooks ) && ! empty( self::$hooks ) ) : ?>
								<?php foreach ( self::$hooks as $hook_cat ) : ?>
								<optgroup label="<?php echo esc_attr( $hook_cat['title'] ); ?>" >
									<?php if ( is_array( $hook_cat['hooks'] ) && ! empty( $hook_cat['hooks'] ) ) : ?>
										<?php foreach ( $hook_cat['hooks'] as $key => $hook ) : ?>
											<?php
											if ( $key == $options['action'] && isset( $hook['description'] ) ) {
												$description = $hook['description'];
											}
											$hook_description = isset( $hook['description'] ) ? $hook['description'] : '';
											?>
										<option <?php selected( $key, $options['action'] ); ?> value="<?php echo esc_attr( $key ); ?>" data-desc="<?php echo esc_attr( $hook_description ); ?>"><?php echo esc_html( $hook['title'] ); ?></option>
									<?php endforeach; ?>
									<?php endif; ?>
								</optgroup>
							<?php endforeach; ?>
							<?php endif; ?>
						</select>
						<p class="description ast-advanced-hook-action-desc <?php echo ( '' == $description ) ? 'ast-no-desc' : ''; ?>"><?php echo esc_html( $description ); ?></p>
					</td>
				</tr>
				<tr class="ast-advanced-hook-row ast-layout-hooks-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Priority', 'astra-addon' ); ?></label>
					</td>
					<td class="ast-advanced-hook-row-content">
					<input type="number" name="ast-advanced-hook-priority" value="<?php echo esc_attr( $options['priority'] ); ?>" placeholder="10" style="width: 50%;"/>
					</td>
				</tr>
				<tr class="ast-advanced-hook-row ast-layout-hooks-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Spacing', 'astra-addon' ); ?></label>
						<i class="ast-advanced-hook-heading-help dashicons dashicons-editor-help" title="<?php esc_attr_e( 'Spacing can be given any positive number with or without units as &quot;5&quot; or &quot;5px&quot;. Default unit is &quot;px&quot;', 'astra-addon' ); ?>"></i>
					</td>
					<td class="ast-advanced-hook-row-content">
						<div class="ast-advanced-hook-padding-top-wrap">
							<input type="text" id="ast-advanced-hook-padding-top" class="ast-advanced-hook-padding ast-advanced-hook-padding-top" name="ast-advanced-hook-padding[top]" value="<?php echo esc_attr( $padding_top ); ?>" placeholder="0" style="width: 35%;"/>
							<label for="ast-advanced-hook-padding-top"><?php esc_html_e( 'Top Spacing', 'astra-addon' ); ?></label>
						</div>
						<div class="ast-advanced-hook-padding-bottom-wrap" >
							<input type="text" id="ast-advanced-hook-padding-bottom" class="ast-advanced-hook-padding ast-advanced-hook-padding-bottom" name="ast-advanced-hook-padding[bottom]" value="<?php echo esc_attr( $padding_bottom ); ?>" placeholder="0" style="width: 35%;"/>
							<label for="ast-advanced-hook-padding-bottom"><?php esc_html_e( 'Bottom Spacing', 'astra-addon' ); ?></label>
						</div>
					</td>
				</tr>

				<tr class="ast-advanced-hook-row ast-target-rules-display ast-layout-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Display On', 'astra-addon' ); ?></label>
						<i class="ast-advanced-hook-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'Add locations for where this Custom Layout should appear.', 'astra-addon' ); ?>"></i>
					</td>
					<td class="ast-advanced-hook-row-content">
					<?php
						Astra_Target_Rules_Fields::target_rule_settings_field(
							'ast-advanced-hook-location',
							array(
								'title'          => __( 'Display Rules', 'astra-addon' ),
								'value'          => '[{"type":"basic-global","specific":null}]',
								'tags'           => 'site,enable,target,pages',
								'rule_type'      => 'display',
								'add_rule_label' => __( 'Add Display Rule', 'astra-addon' ),
							),
							$include_locations
						);
					?>
					</td>
				</tr>
				<tr class="ast-advanced-hook-row ast-target-rules-exclude ast-layout-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Do Not Display On', 'astra-addon' ); ?></label>
						<i class="ast-advanced-hook-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'This Custom Layout will not appear at these locations.', 'astra-addon' ); ?>"></i>
					</td>
					<td class="ast-advanced-hook-row-content">
					<?php
						Astra_Target_Rules_Fields::target_rule_settings_field(
							'ast-advanced-hook-exclusion',
							array(
								'title'          => __( 'Exclude On', 'astra-addon' ),
								'value'          => '[]',
								'tags'           => 'site,enable,target,pages',
								'add_rule_label' => __( 'Add Exclusion Rule', 'astra-addon' ),
								'rule_type'      => 'exclude',
							),
							$exclude_locations
						);
					?>
					</td>
				</tr>
				<tr class="ast-advanced-hook-row ast-target-rules-user ast-layout-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'User Roles', 'astra-addon' ); ?></label>
						<i class="ast-advanced-hook-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'Target this Custom Layout based on user role.', 'astra-addon' ); ?>"></i>
					</td>
					<td class="ast-advanced-hook-row-content">
					<?php
						Astra_Target_Rules_Fields::target_user_role_settings_field(
							'ast-advanced-hook-users',
							array(
								'title'          => __( 'Users', 'astra-addon' ),
								'value'          => '[]',
								'tags'           => 'site,enable,target,pages',
								'add_rule_label' => __( 'Add User Rule', 'astra-addon' ),
							),
							$users
						);
					?>
					</td>
				</tr>

				<tr class="ast-advanced-hook-row ast-target-responsive-display ast-layout-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Responsive Visibility', 'astra-addon' ); ?></label>
						<i class="ast-advanced-hook-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'Select Device for where this Custom Layout should appear.', 'astra-addon' ); ?>"></i>
					</td>
					<td class="ast-advanced-hook-row-content">
						<ul class="ast-advanced-device-display-wrap">
							<li>
								<label>
									<input type="checkbox" name="ast-advanced-display-device[]" value="desktop" <?php echo in_array( 'desktop', $display_devices, true ) ? 'checked="checked"' : ''; ?> />
									<?php esc_html_e( 'Desktop', 'astra-addon' ); ?>
								</label>
							</li>
							<li>
								<label>
									<input type="checkbox" name="ast-advanced-display-device[]" value="tablet" <?php echo in_array( 'tablet', $display_devices, true ) ? 'checked="checked"' : ''; ?> />
									<?php esc_html_e( 'Tablet', 'astra-addon' ); ?>
								</label>
							</li>
							<li>
								<label>
									<input type="checkbox" name="ast-advanced-display-device[]" value="mobile" <?php echo in_array( 'mobile', $display_devices, true ) ? 'checked="checked"' : ''; ?> />
									<?php esc_html_e( 'Mobile', 'astra-addon' ); ?>
								</label>
							</li>
						</ul>
					</td>
				</tr>

				<tr class="ast-advanced-hook-row ast-target-time-duration-display ast-layout-required">
					<td class="ast-advanced-hook-row-heading">
						<label><?php esc_html_e( 'Time Duration', 'astra-addon' ); ?></label>
						<i class="ast-advanced-hook-heading-help dashicons dashicons-editor-help" title="<?php echo esc_attr__( 'Select Time Duration in which this Custom Layout should appear.', 'astra-addon' ); ?>"></i>
					</td>
					<td class="ast-advanced-hook-row-content">
						<ul class="ast-advanced-time-duration-wrap">
							<li>
								<label>
									<input type="checkbox" id="ast-advanced-time-duration-enabled" name="ast-advanced-time-duration[enabled]" value="enabled" <?php checked( isset( $time_duration['enabled'] ) ? $time_duration['enabled'] : '', 'enabled' ); ?> />
									<?php esc_html_e( 'Enable', 'astra-addon' ); ?>
								</label>
							</li>
							<li class="ast-advanced-time-duration-enabled">
								<label for="ast-advanced-time-duration-start-dt"> <?php esc_attr_e( 'Start Date/Time', 'astra-addon' ); ?>:
								<input placeholder="<?php esc_attr_e( 'Click to pick a date', 'astra-addon' ); ?>" class="ast-advanced-date-time-input" type="text" id="ast-advanced-time-duration-start-dt" name="ast-advanced-time-duration[start-dt]"  value="<?php echo esc_attr( $time_duration['start-dt'] ); ?>" readonly />
								</label>
							</li>
							<li class="ast-advanced-time-duration-enabled">
								<label for="ast-advanced-time-duration-end-dt"> <?php esc_attr_e( 'End Date/Time', 'astra-addon' ); ?>:
								<input placeholder="<?php esc_attr_e( 'Click to pick a date', 'astra-addon' ); ?>" class="ast-advanced-date-time-input" type="text" id="ast-advanced-time-duration-end-dt" name="ast-advanced-time-duration[end-dt]" value="<?php echo esc_attr( $time_duration['end-dt'] ); ?>" readonly />
								</label>
							</li>
							<li class="ast-advanced-time-duration-enabled" >
								<label> <?php esc_html_e( 'Timezone:', 'astra-addon' ); ?> </label>
								<a target="_blank" href="<?php echo esc_attr( admin_url( 'options-general.php' ) ); ?>"> <?php echo esc_attr( static::get_wp_timezone_string() ); ?> </a>
							</li>
						</ul>
					</td>
				</tr>

			</table>

			<?php
		}


User Contributed Notes

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