WordPress menu_icon,如何从子主题(/images文件夹)获取图像



我正在使用下面的代码将图像添加到我的自定义帖子类型管理员卷中,但是我想从我的子主题上的/images 文件夹中加载我的图像。知道吗?

// Define icon style for the custom post type
function casestudy_icons() {
?>
<style type="text/css" media="screen">
    #menu-posts-parceria .wp-menu-image { background: url(<?php bloginfo('template_url') ?>/images/casestudy-icon.png) no-repeat 6px -32px !important;
    }
    #menu-posts-parceria:hover .wp-menu-image, #menu-posts-casestudy.wp-has-current-submenu .wp-menu-image {
    background-position:6px 0px !important;
    }
    #icon-edit.icon32-posts-parceria {background: url(<?php bloginfo('template_url') ?>/images/casestudy-32x32.png) no-repeat;}
</style>
<?php
}
add_action( 'admin_head', 'casestudy_icons' );

如果您通过register_post_type注册了自定义帖子类型,那么您应该只使用"menu_icon"参数。

http://codex.wordpress.org/Function_Reference/register_post_type

最新更新