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

时间:2012-04-10 14:02:11

标签: wordpress wordpress-theming

我正在使用下面的代码将图像添加到我的自定义帖子类型管理卷,但是我想在我的子主题上从my / 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' );

1 个答案:

答案 0 :(得分:0)

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

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