Sub_Nav::add_subnav_above_content( string $content )

Summary

Handle subnav visibility above the content


Parameters

$content

(string) (Required)


Return

(string)


Source

File: src/BigCommerce/Accounts/Sub_Nav.php

	public function add_subnav_above_content( $content ) {
		if ( ! is_singular() || ! is_user_logged_in() ) {
			return $content;
		}
		$post_id = get_queried_object_id();
		if ( $post_id !== get_the_ID() ) {
			return $content; // don't filter if we're not on the main post
		}
		/**
		 * Filter whether to display the account subnav before the post content
		 * on account pages.
		 *
		 * @param bool $display True to display the subnav, false to skip it
		 * @param int  $post_id The ID of the current page
		 */
		if ( ! apply_filters( 'bigcommerce/account/do_subnav', true, $post_id ) ) {
			return $content;
		}
		switch ( $post_id ) {
			case get_option( Account_Page::NAME, 0 ):
			case get_option( Orders_Page::NAME, 0 ):
			case get_option( Address_Page::NAME, 0 ):
			case get_option( Wishlist_Page::NAME, 0 ):
				return $this->get_subnav() . $content;
			default:
				return $content;
		}
	}


User Contributed Notes

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