Created
October 10, 2018 19:47
-
-
Save allysonsouza/6ed8bc6e4c4fd2435937e32f192bf8a9 to your computer and use it in GitHub Desktop.
Custom icon in WordPress admin menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_custom_post_type() { | |
register_post_type('labs', [ | |
'label' => 'Labs', | |
'menu_icon' => 'data:image/svg+xml;base64,' . base64_encode('<svg width="20" height="20" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path fill="black" d="M1591 1448q56 89 21.5 152.5t-140.5 63.5h-1152q-106 0-140.5-63.5t21.5-152.5l503-793v-399h-64q-26 0-45-19t-19-45 19-45 45-19h512q26 0 45 19t19 45-19 45-45 19h-64v399zm-779-725l-272 429h712l-272-429-20-31v-436h-128v436z"/></svg>') | |
]); | |
} | |
add_action( 'init', 'my_custom_post_type' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment