Last active
August 29, 2015 14:08
-
-
Save kildeby/6e970e75e601be9839ad to your computer and use it in GitHub Desktop.
Hide a specific shortcake or many from the_content() in Wordpress pages
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 if(has_shortcode(get_the_content(), 'gmedia')) : ?> | |
<?php | |
$pattern = get_shortcode_regex(); | |
preg_match("/$pattern/s", get_the_content(), $matches); | |
?> | |
<div id="content"> | |
<?php echo strip_shortcodes(get_the_content()); ?> | |
</div> | |
<div id="gallery"> | |
<?php echo do_shortcode($matches[0]); ?> | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment