表中显示所有页面列表的一些css似乎与我的一个插件产生了负面反应,它向表中添加了一堆列。我很确定这是edit.php。至少,这就是URL中的内容。
使用Chrome中的开发工具,我注意到表中包含一个名为fixed的类,它将table-layout:fixed添加到表样式中。把它清除掉就可以解决问题了。
问题是,如何编辑此表的样式?
以下是相关代码:
<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类解决了问题,至少在开发人员工具中是这样的。我该怎么移除它?
发布于 2016-10-13 23:37:08
我安装了Chrome (一个用户脚本管理器)的Tampermonkey,并创建了以下userscript:
// ==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,以防万一。
https://wordpress.stackexchange.com/questions/223169
复制相似问题