English (United Kingdom)

apply_filters_ref_array( 'vikappointments_setup_employees_area_main_menu', bool $status, array &$menu )

Fires before displaying the main menu in the Employees Area.


Description

Trigger hook to allow the plugins to alter the items of the main menu displayed within the Employees Area.

Here it is possible to attach new items or detach/edit existing ones.

The items of the menu are associative arrays, which should specify the following attributes:

Name Type Description
active boolean Whether the menu item button is clickable or not.
title string The title to display within the button.
icon string The icon to display before the button title.
query array An array of query attributes to be added within the URL.

 The new items to push within the array must be registered with a unique key.


Parameters

$status

(bool)  True on success, false otherwise.

&$menu

(array)  The main menu array.


Example

The example below replicates the "Coupons" menu item of the sidebar also under the main menu.

/**
 * Trigger hook to allow the plugins to alter the items of the main menu
 * displayed within the Employees Area.
 *
 * @param  boolean  $status  True on success, false otherwise.
 * @param  array    &$menu   The main menu.
 */
add_filter('vikappointments_setup_employees_area_main_menu', function($status, &$menu)
{
    // include the coupon codes item within the main menu
    $menu['coupons'] = [
        'separator' => false,
        'title'     => __('Coupons', 'vikappointments'),
        'icon'      => null,
        'query'     => [
            'view' => 'empcoupons',
        ],
    ];

    return $status;
}, 10, 2);

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-10-08
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information