Astra_Addon_Admin_Loader::admin_dashboard_header( string $title, bool $tabs, string $button_url, string $kb_docs_url )

HTML Template for Admin Top Header preview.


Description


Parameters

$title

(string) (Required) Title.

$tabs

(bool) (Required) Show tabs true/false.

$button_url

(string) (Required) Button redirection URL.

$kb_docs_url

(string) (Required) Button redirection URL.


Source

File: admin/core/class-astra-addon-admin-loader.php

	public static function admin_dashboard_header( $title, $tabs, $button_url, $kb_docs_url ) {
		?>
			<div class="-ml-5 ast-admin-top-bar-root -mb-11.5 [2.875rem] sm:mb-0">
				<div class="bg-white border-b border-slate-200 px-5">
					<div class="max-w-3xl mx-auto lg:max-w-full">
						<div class="relative flex flex-wrap flex-col sm:flex-row justify-between items-start sm:items-center h-full min-h-24 sm:min-h-15 pt-14 pb-2 sm:pb-0 sm:pt-0">
							<div class="flex gap-6">
								<a href="" target="_blank" rel="noopener">
									<img src="<?php echo esc_url( apply_filters( 'astra_admin_menu_icon', ASTRA_THEME_URI . 'inc/assets/images/astra-logo.svg' ) ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound ?>" class="lg:block h-[2.6rem] w-auto ast-theme-icon" alt="Workflow" >
								</a>
								<div class="flex items-center">
									<h5 class="text-lg sm:text-xl leading-6 font-semibold mr-3 pl-6 border-l border-slate-200"><?php echo esc_attr( $title ); ?></h5>
									<a href="<?php echo esc_url( admin_url( $button_url ) ); ?>" class="text-xs text-astra font-medium leading-4 px-3 py-2 rounded-[0.1875rem] border border-astra bg-[#F6F7F7]">Add New</a>
								</div>
							</div>
							<div class="flex justify-end items-center font-inter">
								<?php if ( ! astra_is_white_labelled() ) { ?>
									<div class="text-xs sm:text-sm font-medium sm:leading-[0.875rem] text-slate-600 pr-4 sm:pr-8 border-r border-slate-200">
										<a href="<?php echo esc_url( $kb_docs_url ); ?>" target="_blank"><?php esc_html_e( 'Knowledge base', 'astra-addon' ); ?></a>
									</div>
								<?php } ?>
								<div class="flex items-center text-[0.625rem] sm:text-sm font-medium leading-[1.375rem] text-slate-400 mr-1 sm:mr-3 divide-x divide-slate-200 gap-3 pl-1 sm:pl-3">
									<div class="flex items-center">
										<span><?php echo esc_attr( ASTRA_THEME_VERSION ); ?></span>
										<span class="ml-1 sm:ml-2 text-[0.625rem] leading-[1rem] border border-slate-400 font-medium rounded-[0.1875rem] relative inline-flex flex-shrink-0 py-[0rem] px-1.5"> <?php esc_html_e( 'CORE', 'astra-addon' ); ?> </span>
									</div>
									<div class="flex items-center pl-3">
										<span><?php echo esc_attr( ASTRA_EXT_VER ); ?></span>
										<span class="ml-1 sm:ml-2 text-[0.625rem] leading-[1rem] text-white font-medium border border-slate-800 bg-slate-800 rounded-[0.1875rem] relative inline-flex flex-shrink-0 py-[0rem] px-1.5"> <?php esc_html_e( 'PRO', 'astra-addon' ); ?> </span>
									</div>
									<?php
									if ( ASTRA_ADDON_BSF_PACKAGE ) {
										$highlight_class = BSF_License_Manager::bsf_is_active_license( bsf_extract_product_id( ASTRA_EXT_DIR ) ) ? 'text-[#4AB866]' : '';
										?>
										<div class="pl-3 font-inter <?php echo esc_attr( $highlight_class ); ?>">
											<?php esc_html_e( BSF_License_Manager::bsf_is_active_license( bsf_extract_product_id( ASTRA_EXT_DIR ) ) ? __( 'License activated', 'astra-addon' ) : __( 'License not activated', 'astra-addon' ) ); ?>
										</div>
									<?php } ?>
								</div>
								<?php
								if ( Astra_Ext_White_Label_Markup::show_branding() ) {
									?>
										<a href="<?php echo esc_url( 'https://wpastra.com/changelog/?utm_source=wp&utm_medium=dashboard' ); ?>" target="_blank" class="w-8 sm:w-10 h-8 sm:h-10 flex items-center justify-center cursor-pointer rounded-full border border-slate-200">
											<?php echo ( class_exists( 'Astra_Builder_UI_Controller' ) ) ? Astra_Builder_UI_Controller::fetch_svg_icon( 'horn', false ) : '';  // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
										</a>
									<?php
								}
								?>
							</div>
						</div>
					</div>
				</div>
				<?php
				if ( $tabs ) {
					$current_type = '';
					$active_class = ' text-astra border-astra';
					$current_tab  = self::get_active_tab();

					if ( ! empty( $_REQUEST['layout_type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
						$current_type = $_REQUEST['layout_type']; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
						$active_class = '';
					}

					$url_args = array(
						'post_type'   => ASTRA_ADVANCED_HOOKS_POST_TYPE,
						'layout_type' => $current_tab,
					);

					$custom_layout_types = array(
						'header'   => __( 'Header', 'astra-addon' ),
						'footer'   => __( 'Footer', 'astra-addon' ),
						'hooks'    => __( 'Hooks', 'astra-addon' ),
						'404-page' => __( '404 Page', 'astra-addon' ),
						'content'  => __( 'Page Content', 'astra-addon' ),
					);

					$baseurl = add_query_arg( $url_args, admin_url( 'edit.php' ) );
					?>

					<div class="bg-white border-b border-slate-200 flex flex-wrap items-center -mb-0.5">
						<a class="text-sm font-medium ml-2 px-5 py-4 border-b-2 <?php echo esc_attr( $active_class ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=' . ASTRA_ADVANCED_HOOKS_POST_TYPE ) ); ?>">
							<?php
								echo esc_html__( 'All', 'astra-addon' );
							?>
						</a>
						<?php
						foreach ( $custom_layout_types as $type => $title ) {
							$type_url     = esc_url( add_query_arg( 'layout_type', $type, $baseurl ) );
							$active_class = ( $current_type === $type ) ? ' text-astra border-astra' : 'text-slate-600 border-white';
							?>
									<a class="text-sm font-medium px-5 py-4 border-b-2 <?php echo esc_attr( $active_class ); ?>" href="<?php echo esc_url( $type_url ); ?>">
								<?php echo esc_attr( $title ); ?>
									</a>
								<?php
						}
						?>
					</div>
				<?php } ?>
			</div>
		<?php
	}

Changelog

Changelog
Version Description
4.0.0 Introduced.

User Contributed Notes

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