有没有办法根据帖子的类型在帖子管理中更改行的颜色?

时间:2011-06-03 作者:Justin Long

我想做的是让整行都是不同的颜色-例如,草稿栏的浅蓝色。这样,我就可以直观地一目了然地看到什么是草稿,什么是预定的,什么是在给定的时间段内发布的(我正在开发一个提前几周发布帖子的系统)。

这样做的逻辑方法似乎是改变行的颜色,因为有一个CSS类(“status draft”)。然而,改变行颜色似乎不起作用,因为单个单元格也具有覆盖颜色。

有什么想法?

2 个回复
最合适的回答,由SO网友:Bainternet 整理而成

你是说这样的事?

enter image description here

那就来吧:

add_action(\'admin_footer\',\'style_posts_list\');
function style_posts_list(){
?>
<style>
.status-draft{background-color: #008866 !important;}
.status-pending{background-color: #F53162 !important;}
.status-publish{background-color: #FFF700 !important;}
<?php
}

SO网友:xLRDxREVENGEx

是的,您可以将其添加到您的函数中。当前主题的php文件

<?
add_action(\'admin_head\', \'post_color_css\');

function post_color_css() {
    //Change the #ccc to what hex color you want
    print \'
        <style type="text/css">
        #the-list .status-publish {background-color: #ccc}
        #the-list .status-draft {background-color: #ccc}
        #the-list .status-pending {background-color: #ccc}
        </style>
        \';
}
?>

结束

相关推荐

QUERY_POSTS中自定义帖子类型的ID参数是什么?

在管理部分,我使用quesry帖子来获取自定义帖子的标题和内容此query\\u posts(\'post\\u type=sfnewsletter\');将获得我需要的内容,但不幸的是,我现在需要做的是通过表单传递自定义帖子的ID,然后检索该内容我试过了query_posts(\'p=32\'); query_posts(\'page_id=32\'); query_posts(\'page=32\'); query_posts(\'sfnewsletter_id=3