Astra_Ext_Advanced_Headers_Data::get_current_page_header_ids()

Returns the post IDs for the current page’s header layouts.


Description


Return

(array)


Source

File: addons/advanced-headers/classes/class-astra-ext-advanced-headers-data.php

	public static function get_current_page_header_ids() {

		if ( is_customize_preview() && ! did_action( 'wp' ) ) {
			return false;
		}

		// If header is aleady searched for once, use that value.
		if ( null !== self::$current_page_header ) {
			return self::$current_page_header;
		}

		$option = array(
			'location'  => 'ast-advanced-headers-location',
			'exclusion' => 'ast-advanced-headers-exclusion',
			'users'     => 'ast-advanced-headers-users',
			'page_meta' => 'adv-header-id-meta',
		);
		$posts  = Astra_Target_Rules_Fields::get_instance()->get_posts_by_conditions( 'astra_adv_header', $option );

		if ( is_array( $posts ) && ! empty( $posts ) ) {

			foreach ( $posts as $post_id => $data ) {
				return $post_id;
			}
		}

		// default to false if there is not advanced header on the current page/post.
		return false;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.


User Contributed Notes

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