Last active
August 29, 2015 14:21
-
-
Save blupu/7ce114c3865f8e849331 to your computer and use it in GitHub Desktop.
WP-AppKit: allow embeds (notably iframes) in apps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * Applies to: since WP-AppKit 0.1 | |
| * Goal: By default, embeds are stripped from post content when send to WP-AppKit apps. | |
| * We'd like to display embeds in apps (such as YouTube, Vimeo, SlideShare...). | |
| * Usage: In the app's theme PHP folder or a separate plugin. | |
| */ | |
| add_filter( 'wpak_post_content_format', 'wpak_post_content_with_embeds', 10, 2); | |
| function wpak_post_content_with_embeds( $content, $post ) { | |
| $post = get_post(); | |
| $content = get_the_content(); | |
| //Apply "the_content" filter : formats shortcodes etc... | |
| $content = apply_filters( 'the_content', $content ); | |
| $content = str_replace( ']]>', ']]>', $content ); | |
| $allowed_tags = '<iframe><br/><br><p><div><h1><h2><h3><h4><h5><h6><a><span><sup><sub><img><i><em><strong><b><ul><ol><li><blockquote><pre>'; | |
| $content = strip_tags( $content, $allowed_tags ); | |
| return $content; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment