Helping Organisations get organised!

Developer reference

Markup

Each top-level table is wrapped in <div class="lh_scrollable_tables-wrapper">. The plugin adds one CSS rule, .lh_scrollable_tables-wrapper { overflow-x: auto; }, as an inline stylesheet on every front-end page (handle lh_scrollable_tables-style). Tables whose parent is a table cell, or that are already wrapped, are skipped.

When content is changed

Tables are wrapped by a the_content filter at priority PHP_INT_MAX - 15, so tables added to the content by other plugins’ filters at normal priorities are wrapped too. The filter only acts on content rendered for the page body: after wp_body_open in classic and PHP templates, or while a block template renders its markup (after template_include, before wp_head). Content run for the page head, such as excerpts built for meta tags, content run by other plugins before the template renders, feeds and content without a <table are returned unchanged.

Wrapping uses PHP’s DOMDocument, so the plugin does nothing where the DOM extension is not available. When at least one table is wrapped, the content is re-serialised by DOMDocument, which can reformat whitespace in the markup.

If you like this plugin please consider making a donation to further development