Skip to content

Commit bc8cb19

Browse files
committed
add an option to disable content filters
1 parent 7588103 commit bc8cb19

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

includes/class-shortcodes.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,23 @@ public static function content( $atts, $content, $tag ) {
191191
return '';
192192
}
193193

194+
$atts = shortcode_atts(
195+
array( 'apply_filters' => 'yes' ),
196+
$atts,
197+
$tag
198+
);
199+
194200
$content = \get_post_field( 'post_content', $post );
195201

196-
return \apply_filters( 'the_content', $content );
202+
if ( 'yes' === $atts['apply_filters'] ) {
203+
$content = \apply_filters( 'the_content', $content );
204+
} else {
205+
$content = do_blocks( $content );
206+
$content = wptexturize( $content );
207+
$content = wp_filter_content_tags( $content );
208+
}
209+
210+
return $content;
197211
}
198212

199213
/**

includes/help.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
'<dl>' .
1010
'<dt><code>[ap_title]</code></dt>' .
1111
'<dd>' . \wp_kses( __( 'The post\'s title.', 'activitypub' ), 'default' ) . '</dd>' .
12-
'<dt><code>[ap_content]</code></dt>' .
13-
'<dd>' . \wp_kses( __( 'The post\'s content.', 'activitypub' ), 'default' ) . '</dd>' .
12+
'<dt><code>[ap_content apply_filters="yes"]</code></dt>' .
13+
'<dd>' . \wp_kses( __( 'The post\'s content. With <code>apply_filters</code> you can decide if filters should be applied or not (default is <code>yes</code>). The values can be <code>yes</code> or <code>no</code>. <code>apply_filters</code> attribute is optional.', 'activitypub' ), 'default' ) . '</dd>' .
1414
'<dt><code>[ap_excerpt lenght="400"]</code></dt>' .
1515
'<dd>' . \wp_kses( __( 'The post\'s excerpt (default 400 chars). <code>length</code> attribute is optional.', 'activitypub' ), 'default' ) . '</dd>' .
1616
'<dt><code>[ap_permalink type="url"]</code></dt>' .
17-
'<dd>' . \wp_kses( __( 'The post\'s permalink. Type can be either: <code>url</code> or <code>html</code> (an &lt;a /&gt; tag). <code>type</code> attribute is optional.', 'activitypub' ), 'default' ) . '</dd>' .
17+
'<dd>' . \wp_kses( __( 'The post\'s permalink. <code>type</code> can be either: <code>url</code> or <code>html</code> (an &lt;a /&gt; tag). <code>type</code> attribute is optional.', 'activitypub' ), 'default' ) . '</dd>' .
1818
'<dt><code>[ap_shortlink type="url"]</code></dt>' .
19-
'<dd>' . \wp_kses( __( 'The post\'s shortlink. Type can be either <code>url</code> or <code>html</code> (an &lt;a /&gt; tag). I can recommend <a href="https://wordpress.org/plugins/hum/" target="_blank">Hum</a>, to prettify the Shortlinks. <code>type</code> attribute is optional.', 'activitypub' ), 'default' ) . '</dd>' .
19+
'<dd>' . \wp_kses( __( 'The post\'s shortlink. <code>type</code> can be either <code>url</code> or <code>html</code> (an &lt;a /&gt; tag). I can recommend <a href="https://wordpress.org/plugins/hum/" target="_blank">Hum</a>, to prettify the Shortlinks. <code>type</code> attribute is optional.', 'activitypub' ), 'default' ) . '</dd>' .
2020
'<dt><code>[ap_hashtags]</code></dt>' .
2121
'<dd>' . \wp_kses( __( 'The post\'s tags as hashtags.', 'activitypub' ), 'default' ) . '</dd>' .
2222
'<dt><code>[ap_hashcats]</code></dt>' .

0 commit comments

Comments
 (0)