Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // wordpress post type icons changing by font icon / images|| smof tab icons changing
- // wordpress default icons cdn
- function firoze() {
- wp_register_style('firoze_fonts', 'https://developer.wordpress.org/wp-includes/css/dashicons.min.css');
- wp_enqueue_style( 'firoze_fonts');
- }
- add_action('wp_print_styles', 'firoze');
- // for calling icon
- function add_append_jquery_in_admin_head(){
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function(){
- <!-- images usages -->
- jQuery('li.changeicon a ').append('<img src="http://lorempixel.com/15/15/nature" alt="" />');
- <!-- wordpress default icons usages -->
- jQuery('li.loremicon a ').append('<span class="dashicons dashicons-wordpress"></span>');
- });
- </script>
- <style type="text/css">
- #of-nav ul li{position:relative;}
- .changeicon img, .loremicon img {
- height: 15px;left: 0;
- padding-left: 12px;padding-right: 5px;position: absolute;width: 15px;top:12px;}
- .loremicon span{color: #52B231;
- display: inline-block;
- font-size: 18px;
- left: 10px;
- position: absolute;}
- </style>
- <?php
- }
- add_action('admin_head', 'add_append_jquery_in_admin_head');
- // register post type images changing
- register_post_type( 'acme_product',
- array(
- 'labels' => array(
- 'name' => __( 'Products' ),
- 'singular_name' => __( 'Product' ),
- 'add_new'=>_('Add New product'),
- ),
- 'public' => true,
- 'has_archive' => true,
- 'rewrite'=> array( 'slug' => 'product' ),
- 'supports'=> array( 'title', 'editor', 'custom-fields', 'author', 'comments', '' ),
- // 'menu_icon' => get_template_directory_uri() . '/image/icon-portfolio.png',
- 'menu_icon' => 'dashicons-portfolio',
- )
- );
- // get wordpress all default all icons from here
- https://developer.wordpress.org/resource/dashicons/#wordpress
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement