Created
February 10, 2012 20:37
-
-
Save curtismchale/1792678 to your computer and use it in GitHub Desktop.
remove polldaddy from content
This file contains 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
/** | |
* Removing the poll from the main content since | |
* we push it in to the sidebar | |
* | |
* @since 1.0 | |
*/ | |
function sfn_remove_poll_daddy( $content = null ){ | |
global $post; | |
$content = $post->post_content; | |
if( is_single() && is_main_query() && get_post_type() == 'post' ){ | |
$pattern = get_shortcode_regex(); | |
preg_match('/'.$pattern.'/s', $content, $matches); | |
if ( isset($matches[2]) && is_array($matches) && $matches[2] == 'polldaddy') { | |
//shortcode is being used | |
$content = str_replace( $matches['0'], ' ', $content ); | |
} | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'sfn_remove_poll_daddy' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment