Dealing with menu icon
This commit is contained in:
parent
bcb3b06bc3
commit
b6e49b77c8
@ -31,16 +31,20 @@ class AdminSettings {
|
||||
* @return void
|
||||
*/
|
||||
public function add_admin_menu(): void {
|
||||
$page_title = __( 'Namespace Plugin Name - Settings', 'nmsp_plugin_name_settings_title' );
|
||||
$menu_title = __( 'Settings', 'nmsp_plugin_name_settings_title' );
|
||||
$page_title = __( 'Plugin Name', 'nmsp_plugin_name_settings_title' );
|
||||
$menu_title = __( 'Plugin Name', 'nmsp_plugin_name_settings_title' );
|
||||
$capability = 'manage_options';
|
||||
$menu_slug = 'nmsp-plugin-name-menu-slug';
|
||||
$icon = plugins_url( '../assets/images/menu-icon.svg', __FILE__ );
|
||||
$position = 100;
|
||||
$callback = array( $this, 'show_main_settings_page' );
|
||||
$callback = '';
|
||||
$icon = 'data:image/svg+xml;base64,' . base64_encode( file_get_contents( NMSP_PLUGIN_BASE_DIR . '/assets/images/menu-icon.svg' ) );
|
||||
$position = 100; // after the separator below "Settings"
|
||||
|
||||
$subpage_title = __( 'Namespace Plugin Name - Settings', 'nmsp_plugin_name_settings_title' );
|
||||
$submenu_title = __( 'Settings', 'nmsp_plugin_name_settings_title' );
|
||||
$subcallback = array( $this, 'show_main_settings_page' );
|
||||
|
||||
add_menu_page( $page_title, $menu_title, $capability, $menu_slug, '', $icon, $position );
|
||||
add_submenu_page( $menu_slug, $page_title, $menu_title, $capability, $menu_slug, $callback );
|
||||
add_submenu_page( $menu_slug, $subpage_title, $submenu_title, $capability, $menu_slug, $subcallback );
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,12 @@
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" preserveAspectRatio="xMidYMid meet">
|
||||
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
||||
<rect x="9" y="9" width="6" height="6"></rect>
|
||||
<line x1="9" y1="1" x2="9" y2="4"></line>
|
||||
<line x1="15" y1="1" x2="15" y2="4"></line>
|
||||
<line x1="9" y1="20" x2="9" y2="23"></line>
|
||||
<line x1="15" y1="20" x2="15" y2="23"></line>
|
||||
<line x1="20" y1="9" x2="23" y2="9"></line>
|
||||
<line x1="20" y1="14" x2="23" y2="14"></line>
|
||||
<line x1="1" y1="9" x2="4" y2="9"></line>
|
||||
<line x1="1" y1="14" x2="4" y2="14"></line>
|
||||
</svg>
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 717 B |
@ -48,6 +48,10 @@ if ( ! defined('NMSP_PLUGIN_BASE_DIR') ) {
|
||||
define( 'NMSP_PLUGIN_BASE_DIR', __DIR__ );
|
||||
}
|
||||
|
||||
if ( ! defined('NMSP_PLUGIN_BASE_FILE') ) {
|
||||
define( 'NMSP_PLUGIN_BASE_FILE', __FILE__ );
|
||||
}
|
||||
|
||||
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
require_once __DIR__ . '/bootstrap.php';
|
||||
|
Loading…
x
Reference in New Issue
Block a user