frozzare/wp-content-menu

Adds a content menu to WordPress admin

Installs: 1 266

Dependents: 0

Suggesters: 0

Security: 0

Stars: 8

Watchers: 2

Forks: 0

Open Issues: 0

Type:wordpress-plugin

v1.0.4 2017-02-14 12:19 UTC

This package is auto-updated.

Last update: 2024-10-29 03:48:23 UTC


README

Build Status No Maintenance Intended

Adds a content menu to WordPress admin where all your post types that are used for content can live, when doing this the post type configured to use content menu will be removed from the admin menu and if you have a lot of post types you will see a more clean admin menu than before.

Both post and page will be moved to content menu by default and can be unmoved by content_menu_post_types filter.

Content menu will only have submenu items when a post type is selected so you can see and use the submenu items for that post types, as you can see in the second screenshot.

Installation

composer require frozzare/wp-content-menu

Usage

To move your post types into content menu you can set content_menu to true in register_post_type or use content_menu_post_types filter.

// With `register_post_type`
register_post_type( 'book', [
  'content_menu' => true
] );

// With the filter.
add_filter( 'content_menu_post_types', function ( $post_types ) {
  return ['page', 'post', 'book']
} );

You can modify Add New Book label by content_menu_add_new_item_label filter.

add_filter( 'content_menu_add_new_item_label', function ( $label ) {
  return 'Add New';
} );

Disable content menu for users:

add_filter( 'content_menu_user_allowed', function ( $allowed, $user ) {
  return false;
}, 10, 2 );

Screenshots

Contributing

Everyone is welcome to contribute with patches, bug-fixes and new features.

License

MIT © Fredrik Forsmo