White label mode
One of the coolest Notification features is white labeling. To put it in this mode you’ll need to call just one function:
1
add_action( 'notification/init', function() {
2
notification_whitelabel();
3
} );
Copied!
What it does is just remove all the default triggers and the upselling. The fun part starts with the parameters you can use. See below:
1
notification_whitelabel( [
2
// admin page hook under which you want the Notifications to be displayed.
3
'page_hook' => 'edit.php?post_type=page',
4
// if display extensions.
5
'extensions' => false,
6
// if display settings.
7
'settings' => false,
8
// control settings access, provided user IDs will have an access.
9
// this works only if settings are enabled.
10
'settings_access' => array( 123, 456 ),
11
] );
Copied!
If the Notifications page is moved to a submenu of another page, the settings and extensions are added as a separate submenu.

Adjusting Notification post type labels and capabilities

As easy as using two filters.

Labels

1
add_filter( 'notification/whitelabel/cpt/labels', function( $labels ) {
2
​
3
// These are the defaults.
4
return [
5
'name' => __( 'Notifications', 'notification' ),
6
'singular_name' => __( 'Notification', 'notification' ),
7
'add_new' => _x( 'Add New Notification', 'notification', 'notification' ),
8
'add_new_item' => __( 'Add New Notification', 'notification' ),
9
'edit_item' => __( 'Edit Notification', 'notification' ),
10
'new_item' => __( 'New Notification', 'notification' ),
11
'view_item' => __( 'View Notification', 'notification' ),
12
'search_items' => __( 'Search Notifications', 'notification' ),
13
'not_found' => __( 'No Notifications found', 'notification' ),
14
'not_found_in_trash' => __( 'No Notifications found in Trash', 'notification' ),
15
'parent_item_colon' => __( 'Parent Notification:', 'notification' ),
16
'menu_name' => __( 'Notifications', 'notification' ),
17
];
18
​
19
} );
Copied!

Capabilities

1
add_filter( 'notification/post_type/capabilities', function( $capabilities ) {
2
​
3
// These are the defaults.
4
return [
5
'edit_post' => 'manage_options',
6
'read_post' => 'manage_options',
7
'delete_post' => 'manage_options',
8
'edit_posts' => 'manage_options',
9
'edit_others_posts' => 'manage_options',
10
'delete_posts' => 'manage_options',
11
'publish_posts' => 'manage_options',
12
'read_private_posts' => 'manage_options'
13
];
14
​
15
} );
Copied!
Last modified 1mo ago