admin管理员组文章数量:1392098
How can I add a CSS id to the row that contains my custom plugin in the plugins list table i.e (/wp-admin/plugins.php)?
What I want to achieve is displaying an admin notice like this
<p>Enter your license <a href="#custom-plugin">here</a> to activate the plugin</p>
When user click on the link it should scroll to that particular plugin row.
How can I add a CSS id to the row that contains my custom plugin in the plugins list table i.e (/wp-admin/plugins.php)?
What I want to achieve is displaying an admin notice like this
<p>Enter your license <a href="#custom-plugin">here</a> to activate the plugin</p>
When user click on the link it should scroll to that particular plugin row.
Share Improve this question edited Feb 5, 2020 at 15:43 SkyRar asked Feb 5, 2020 at 11:56 SkyRarSkyRar 2122 silver badges9 bronze badges 1- Most licenses I've seen are entered on options pages instead of the plugins list page. Maybe you could add a options/settings page instead, so visitors can go straight to it without you having to add an ID? – WebElaine Commented Feb 5, 2020 at 16:42
1 Answer
Reset to default 0Updated answer on how to target with JS: since jQuery is included in wp-admin, you can still target the link with the row's existing data-slug.
Example of how to target all the links:
jQuery('tr[data-slug="my-plugin-slug"] a'.css('color', 'green');
(You can inspect the elements to work out a way to target just one specific link, if that's your goal, and of course you can change other properties besides the CSS link color.)
Original answer on how to target the CSS: You could accomplish the same goal by targeting the data-slug or data-plugin attribute:
tr[data-slug="my-plugin-slug"] {
// your css here
}
The slug is the folder name your plugin is in; and the data-plugin attribute is the folder plus the filename.
本文标签: filtersIs it possible to assign a css id to a row in plugins list table
版权声明:本文标题:filters - Is it possible to assign a css id to a row in plugins list table? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744775235a2624583.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论