Skip to content

Commit 1ca3ed1

Browse files
authored
Merge pull request #267 from RRZE-Webteam/dev
v1.25.4
2 parents 391fc0d + b861d5c commit 1ca3ed1

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

includes/Table/Table.php

+9-6
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@
1212
class Table {
1313

1414
public function __construct() {
15-
add_shortcode('tablescript', [$this, 'shortcodeTablescript']);
1615
add_action('wp_enqueue_scripts', [$this, 'enqueueScripts']);
16+
add_filter( 'the_content', [$this, 'includeTablescript'] );
1717
}
1818

19-
public function shortcodeTablescript($atts, $content = '', $tag = '') {
20-
wp_enqueue_script('rrze-tables');
21-
$script = 'jQuery(function($) { $("table.sorttable").tablesorter(); $("table.filtertable").tablesorter({widgets: ["filter"], filter_columnAnyMatch: true, }); }); ';
22-
wp_add_inline_script('rrze-tables', $script, 'after' );
23-
wp_enqueue_style('rrze-elements');
19+
public function includeTablescript($content) {
20+
if (strpos($content, '<table ') !== false) {
21+
wp_enqueue_script('rrze-tables');
22+
$script = 'jQuery(function($) { $("table.sorttable").tablesorter(); $("table.filtertable").tablesorter({widgets: ["filter"], filter_columnAnyMatch: true, }); }); ';
23+
wp_add_inline_script('rrze-tables', $script, 'after' );
24+
wp_enqueue_style('rrze-elements');
25+
}
26+
return $content;
2427
}
2528

2629
public static function enqueueScripts() {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rrze-elements",
3-
"version": "1.25.3",
3+
"version": "1.25.4",
44
"description": "RRZE Elements: Gestalterische Erweiterungen für Webauftritte.",
55
"main": "rrze-elements.php",
66
"textdomain": "rrze-elements",

rrze-elements.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: RRZE Elements
55
Plugin URI: https://github.com/RRZE-Webteam/rrze-elements
66
Description: Advanced design elements for WordPress websites.
7-
Version: 1.25.3
7+
Version: 1.25.4
88
Author: RRZE Webteam
99
Author URI: https://blogs.fau.de/webworking/
1010
License: GNU General Public License v2
@@ -23,7 +23,7 @@
2323

2424
const RRZE_PHP_VERSION = '7.4';
2525
const RRZE_WP_VERSION = '5.9';
26-
const RRZE_ELEMENTS_VERSION = '1.25.3';
26+
const RRZE_ELEMENTS_VERSION = '1.25.4';
2727

2828
spl_autoload_register(function ($class) {
2929
$prefix = __NAMESPACE__;

0 commit comments

Comments
 (0)