首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当您单击pages/post时,如何编辑管理中列出的页面/帖子表的样式?

当您单击pages/post时,如何编辑管理中列出的页面/帖子表的样式?
EN

WordPress Development用户
提问于 2016-04-09 05:10:20
回答 1查看 2.2K关注 0票数 0

表中显示所有页面列表的一些css似乎与我的一个插件产生了负面反应,它向表中添加了一堆列。我很确定这是edit.php。至少,这就是URL中的内容。

使用Chrome中的开发工具,我注意到表中包含一个名为fixed的类,它将table-layout:fixed添加到表样式中。把它清除掉就可以解决问题了。

问题是,如何编辑此表的样式?

以下是相关代码:

代码语言:javascript
复制
<form id="posts-filter" method="get">
...
<h2 class='screen-reader-text'>Pages list</h2>
<table class="wp-list-table widefat fixed striped pages">

表单元素是带有ID的隐藏父元素,需要针对的是带有类wp-list-table的表。删除fixed类解决了问题,至少在开发人员工具中是这样的。我该怎么移除它?

EN

回答 1

WordPress Development用户

回答已采纳

发布于 2016-10-13 23:37:08

我安装了Chrome (一个用户脚本管理器)的Tampermonkey,并创建了以下userscript:

代码语言:javascript
复制
// ==UserScript==
// @name         Fix edit.php!
// @author       You
// @match        http://www.example.com/wp-admin/edit.php*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...

    function addGlobalStyle(css) {
        var head, style;
        head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    }
    addGlobalStyle('.fixed { table-layout:auto !important; }');

})();

它很轻,所以它根本不会减慢页面的速度。据我所知,自从WP更新之后,这个问题就不再存在了,但是我仍然有这个userscript,以防万一。

票数 0
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/223169

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档