| @@ -271,12 +271,13 @@ | ||
| 271 | 271 | // for lazy load |
| 272 | 272 | // set 'yes' to use the default intersection limit (300px) |
| 273 | 273 | // OR set a number (e.g. 700) to use 700px as the intersection limit |
| 274 | 274 | 'lazy' => apply_filters( 'visualizer_lazy_by_default', false, $atts['id'] ), |
| 275 | + // Use image chart | |
| 276 | + 'use_image' => 'no', | |
| 275 | 277 | ), |
| 276 | 278 | $atts |
| 277 | 279 | ); |
| 278 | - | |
| 279 | 280 | // if empty id or chart does not exists, then return empty string |
| 280 | 281 | if ( ! $atts['id'] || ! ( $chart = get_post( $atts['id'] ) ) || $chart->post_type !== Visualizer_Plugin::CPT_VISUALIZER ) { |
| 281 | 282 | return ''; |
| 282 | 283 | } |
| @@ -339,9 +340,16 @@ | ||
| 339 | 340 | $id = $id . '-' . rand(); |
| 340 | 341 | |
| 341 | 342 | $amp = Visualizer_Plugin::instance()->getModule( Visualizer_Module_AMP::NAME ); |
| 342 | 343 | if ( $amp && $amp->is_amp() ) { |
| 343 | - return '<div id="' . $id . '"' . $this->getHtmlAttributes( $attributes ) . '>' . $amp->get_chart( $chart, $data, $series, $settings ) . '</div>'; | |
| 344 | + return '<div data-amp-auto-lightbox-disable id="' . $id . '"' . $this->getHtmlAttributes( $attributes ) . '>' . $amp->get_chart( $chart, $data, $series, $settings ) . '</div>'; | |
| 345 | + } | |
| 346 | + | |
| 347 | + if ( 'yes' === $atts['use_image'] ) { | |
| 348 | + $chart_image = get_post_meta( $chart->ID, Visualizer_Plugin::CF_CHART_IMAGE, true ); | |
| 349 | + if ( $chart_image ) { | |
| 350 | + return '<div id="' . $id . '"' . $this->getHtmlAttributes( $attributes ) . '>' . wp_get_attachment_image( $chart_image, 'full' ) . '</div>'; | |
| 351 | + } | |
| 344 | 352 | } |
| 345 | 353 | |
| 346 | 354 | // add chart to the array |
| 347 | 355 | $this->_charts[ $id ] = array( |