Initial commit
This commit is contained in:
32
inc/classes/Tables.php
Normal file
32
inc/classes/Tables.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Klasa Tables
|
||||
*
|
||||
* @link https://krzysztof-turek.com
|
||||
*
|
||||
* @package tylkofotografia.pl
|
||||
* @version 0.2
|
||||
*/
|
||||
class Tables {
|
||||
|
||||
use Singleton;
|
||||
|
||||
function __construct() {
|
||||
$this->setupFilter();
|
||||
}
|
||||
|
||||
protected function setupFilter() {
|
||||
add_filter( 'the_content', [$this, 'bootstrapResponsiveTable'] );
|
||||
}
|
||||
|
||||
public function bootstrapResponsiveTable( $content ) {
|
||||
$content = preg_replace('/<table[^>]*class=["\'][^"\']*["\']/i', '<table', $content);
|
||||
|
||||
$content = str_replace(
|
||||
[ '<table>', '</table>' ],
|
||||
[ '<table class="table table-bordered table-hover table-sm">', '</table>' ],
|
||||
$content
|
||||
);
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user