开发者 | shawfactor |
---|---|
更新时间 | 2022年7月31日 14:36 |
捐献地址: | 去捐款 |
PHP版本: | 4.0 及以上 |
WordPress版本: | 6.0 |
Vanilla javascript means using plain JavaScript without any additional libraries like jQuery. Using vanilla js maximises compatibility, minimises code bloat, and gives you the best chance that the functionality will still work as browsers change.
Firstly you need a table with the class="sortable" (this ensures the javascript and css are added) You also need the table header to follow the standard thead->tr->th nesting and the table body to follow the standard tbody->tr->td nesting for sorting to work.
The styling added by the plugin is neutral, and there are deliberately no options with this plugin. But if you want your own styling that harmonises with your site there are filters. The filters can be viewed in the code. And an example is here: https://lhero.org/portfolio/lh-sortable-tables/#modifying-the-table-css
This plugin ONLY adds the javascript and css if a table with the class="sortable" id exists in the post, page or CPT content. This means assets are not added unnnecessarily (and thus slow down your site). This plugin also uses the best javascript library for table sorting I can find, with many additional features.
LH Sortable Tables, and all https://lhero.org plugins are made to WordPress standards. Therefore they should work with all well coded plugins and themes. However not all plugins and themes are well coded (and this includes many popular ones). If something does not work properly, firstly deactivate ALL other plugins and switch to one of the themes that come with core, e.g. twentyfirteen, twentysixteen etc. If the problem persists pleasse leave a post in the support forum: https://wordpress.org/support/plugin/lh-sortable-tables/ . I look there regularly and resolve most queries.
This plugin relies on the https://developer.wordpress.org/reference/hooks/wp_body_open/ hook. 98% of themes include it and it is now a standard. If yours does not, create a child theme, or get a better theme.
Please contact me for custom work and enhancements here: https://shawfactor.com/contact/