Inventory_Presser_Admin_Bar::add_vehicles_to_admin_bar( WP_Admin_Bar $admin_bar )

Adds a Vehicle button to the Admin Bar

On This Page


Parameters Parameters

$admin_bar

(WP_Admin_Bar) (Required) The WP_Admin_Bar object.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/class-admin-bar.php

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
public function add_vehicles_to_admin_bar( $admin_bar ) {
    // Do not add an admin bar item if we are looking at the dashboard.
    // Only show this item to users who can edit posts.
    if ( is_admin() || ! current_user_can( 'edit_posts' ) ) {
        return;
    }
 
    $admin_bar->add_node(
        array(
            'id'     => 'wp-admin-bar-vehicles',
            'title'  => __( 'Vehicles', 'inventory-presser' ),
            'href'   => admin_url( 'edit.php?post_type=' . INVP::POST_TYPE ),
            'parent' => 'site-name',
        )
    );
}