Skip to content

Commit d2b69ba

Browse files
author
Eugene Manuilov
committed
[re #16] Added ability to pass class name into shortcode attributes
1 parent e1d8567 commit d2b69ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

classes/Visualizer/Module/Frontend.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public function enqueueScripts() {
9090
public function renderChart( $atts ) {
9191
$atts = shortcode_atts( array(
9292
'id' => false, // chart id
93+
'class' => false, // chart class
9394
'series' => false, // series filter hook
9495
'data' => false, // data filter hook
9596
), $atts );
@@ -100,6 +101,8 @@ public function renderChart( $atts ) {
100101
}
101102

102103
$id = 'visualizer-' . $atts['id'];
104+
$class = !empty( $atts['class'] ) ? ' class="' . $atts['class'] . '"' : '';
105+
103106
$type = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_TYPE, true );
104107

105108
// faetch and update settings
@@ -133,7 +136,7 @@ public function renderChart( $atts ) {
133136
wp_localize_script( 'visualizer-render', 'visualizer', array( 'charts' => $this->_charts ) );
134137

135138
// return placeholder div
136-
return '<div id="' . $id . '"></div>';
139+
return '<div id="' . $id . '"' . $class . '></div>';
137140
}
138141

139142
}

0 commit comments

Comments
 (0)