Astra_Mobile_Header::toggle_button( string $item_output, WP_Post $item, int $depth, stdClass $args )

Add submenu toggle button used for mobile devices.


Description


Parameters

$item_output

(string) (Required) The menu item's starting HTML output.

$item

(WP_Post) (Required) Menu item data object.

$depth

(int) (Required) Depth of menu item. Used for padding.

$args

(stdClass) (Required) An object of wp_nav_menu() arguments.


Return

(String) Menu item's starting markup.


Source

File: inc/class-astra-mobile-header.php

		public function toggle_button( $item_output, $item, $depth, $args ) {

			$menu_locations = array( 'primary', 'above_header_menu', 'secondary_menu', 'below_header_menu', 'mobile_menu' );

			for ( $index = 3; $index <= Astra_Builder_Helper::$component_limit; $index++ ) {
				array_push( $menu_locations, 'menu_' . $index );
			}

			// Add toggle button if menu is from Astra.
			if ( true === is_object( $args ) ) {
				if ( isset( $args->theme_location ) && in_array( $args->theme_location, $menu_locations ) ) {
					if ( isset( $item->classes ) && in_array( 'menu-item-has-children', $item->classes ) ) {
						$item_output = $this->menu_arrow_button_markup( $item_output, $item );
					}
				}
			} else {
				if ( isset( $item->post_parent ) && 0 === $item->post_parent ) {
					$item_output = $this->menu_arrow_button_markup( $item_output, $item );
				}
			}

			return $item_output;
		}

Changelog

Changelog
Version Description
1.6.9 Introduced.


User Contributed Notes

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