diff --git a/src/classes/entities/class-tainacan-item.php b/src/classes/entities/class-tainacan-item.php index e2811e78e..5ce5eb694 100644 --- a/src/classes/entities/class-tainacan-item.php +++ b/src/classes/entities/class-tainacan-item.php @@ -771,8 +771,8 @@ class Item extends Entity { } } - - return apply_filters("tainacan-item-get-document-as-html", wp_kses_post($output), $img_size, $this); + $allowed_html = wp_kses_allowed_html('tainacan_post'); + return apply_filters("tainacan-item-get-document-as-html", wp_kses($output, $allowed_html), $img_size, $this); } @@ -806,8 +806,8 @@ class Item extends Entity { $output .= $embed; } } - - return wp_kses_post($output); + $allowed_html = wp_kses_allowed_html('tainacan_post'); + return wp_kses($output, $allowed_html); } diff --git a/src/classes/theme-helper/template-tags.php b/src/classes/theme-helper/template-tags.php index 7956af9be..d096681aa 100644 --- a/src/classes/theme-helper/template-tags.php +++ b/src/classes/theme-helper/template-tags.php @@ -3,6 +3,13 @@ use \Tainacan\Entities; use \Tainacan\Repositories; +function tainacan_get_default_allowed_styles ( $styles ) { + $styles[] = 'display'; + $styles[] = 'position'; + $styles[] = 'visibility'; + return $styles; +} + /** * To be used inside The Loop * @@ -332,7 +339,9 @@ function tainacan_get_the_media_component( $args['media_main_id'] = $media_id . '-main'; $args['media_thumbs_id'] = $media_id . '-thumbs'; $args['media_id'] = $media_id; - + $allowed_html = wp_kses_allowed_html('tainacan_post'); + add_filter( 'safe_style_css', 'tainacan_get_default_allowed_styles'); + if ( $args['has_media_main'] || $args['has_media_thumbs'] ) : // Modal lightbox layer for rendering photoswipe add_action('wp_footer', 'tainacan_get_the_media_modal_layer'); @@ -363,7 +372,9 @@ function tainacan_get_the_media_component(