WC_Admin_Customize::register_customize_nav_menu_items()
Register account endpoints to customize nav menu items.
Метод класса: WC_Admin_Customize{}
Хуки из метода
Возвращает
Массив
.
Использование
$WC_Admin_Customize = new WC_Admin_Customize(); $WC_Admin_Customize->register_customize_nav_menu_items( $items, $type, $object, $page );
- $items(массив)
- List of nav menu items.
По умолчанию: array() - $type(строка)
- Nav menu type.
По умолчанию: '' - $object(строка)
- Nav menu object.
По умолчанию: '' - $page(int)
- Page number.
Список изменений
С версии 3.1.0 | Введена. |
Код WC_Admin_Customize::register_customize_nav_menu_items() WC Admin Customize::register customize nav menu items WC 8.7.0
public function register_customize_nav_menu_items( $items = array(), $type = '', $object = '', $page = 0 ) { if ( 'woocommerce_endpoint' !== $object ) { return $items; } // Don't allow pagination since all items are loaded at once. if ( 0 < $page ) { return $items; } // Get items from account menu. $endpoints = wc_get_account_menu_items(); // Remove dashboard item. if ( isset( $endpoints['dashboard'] ) ) { unset( $endpoints['dashboard'] ); } // Include missing lost password. $endpoints['lost-password'] = __( 'Lost password', 'woocommerce' ); $endpoints = apply_filters( 'woocommerce_custom_nav_menu_items', $endpoints ); foreach ( $endpoints as $endpoint => $title ) { $items[] = array( 'id' => $endpoint, 'title' => $title, 'type_label' => __( 'Custom Link', 'woocommerce' ), 'url' => esc_url_raw( wc_get_account_endpoint_url( $endpoint ) ), ); } return $items; }