Skip to content

Commit

Permalink
Filter to allow html tags in caption (#37)
Browse files Browse the repository at this point in the history
* Filter to allow html tags in caption
  • Loading branch information
pederan authored Feb 28, 2020
1 parent 10b19e2 commit f484ff9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 1.3.7
- Added filter to allow html tags in captions (`hogan/module/gallery/caption/allowed_html`)

## 1.3.6
- Added filter to override the post values for the gallery item (`hogan/module/gallery/item`)
- Use innerHTML instead of textContent to fetch the content of figcaption. This way html `<br>` can be used to create line breaks.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Install the module using Composer `composer require dekodeinteraktiv/hogan-galle
- `hogan/module/gallery/heading/enabled` for enabling heading field, default true.
- `hogan/module/gallery/slider/flickity` flickity options. See https://flickity.metafizzy.co/options.html
- `hogan/module/gallery/item` for overriding the post values for the gallery item.
- `hogan/module/gallery/caption/allowed_html` for allowing html tags in captions.
4 changes: 2 additions & 2 deletions assets/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ class="<?php echo esc_attr( $classnames ); ?>"
esc_attr( hogan_classnames( 'hogan-gallery-caption', [
'screen-reader-text' => ! $is_slider,
] ) ),
wp_kses( $item['caption'], [
wp_kses( $item['caption'], apply_filters( 'hogan/module/gallery/caption/allowed_html', [
'br' => [],
] )
] ) )
);
}
?>
Expand Down
4 changes: 2 additions & 2 deletions hogan-gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://github.com/dekodeinteraktiv/hogan-gallery
* GitHub Plugin URI: https://github.com/dekodeinteraktiv/hogan-gallery
* Description: Image Gallery Module for Hogan
* Version: 1.3.6
* Version: 1.3.7
* Author: Dekode
* Author URI: https://en.dekode.no
* License: GPL-3.0-or-later
Expand All @@ -24,7 +24,7 @@
exit; // Exit if accessed directly.
}

define( 'HOGAN_GALLERY_VERSION', '1.3.6' );
define( 'HOGAN_GALLERY_VERSION', '1.3.7' );

add_action( 'plugins_loaded', __NAMESPACE__ . '\\hogan_load_textdomain' );
add_action( 'hogan/include_modules', __NAMESPACE__ . '\\hogan_register_module', 10, 1 );
Expand Down

0 comments on commit f484ff9

Please sign in to comment.