开发者

WordPress Custom Theme Favicon in Dashboard Menu

开发者 https://www.devze.com 2022-12-23 14:57 出处:网络
When you create a custom theme in WordPress, you can add a link to your theme options on the left menu in the WP dashboard. The开发者_开发知识库 default icon that\'s used next to your menu label is ca

When you create a custom theme in WordPress, you can add a link to your theme options on the left menu in the WP dashboard. The开发者_开发知识库 default icon that's used next to your menu label is called generic.png and resides in the wp-admin/images directory.

Anyone know how to tell WP to use my theme's custom favicon.png instead of the default?


I figured this one out. Hopefully it can help others:

add_menu_page('Page title', 'Top-level menu title', 
'administrator', 'my-top-level-handle',
'my_magic_function','../wp-content/themes/yourTheme/img/favicon.png');

You can also add a submenu under your theme's main menu item like so...

add_submenu_page( 'my-top-level-handle', 'Page title',
'Sub-menu title', 'administrator', 'my-submenu-handle', 'my_magic_function')


Easiest way is to use ICO format for your Favicon.

If you have other image for and want it to convert in ICO format, you can use ICO Converter to do that!

0

精彩评论

暂无评论...
验证码 换一张
取 消