Skip to content

Instantly share code, notes, and snippets.

@curtismchale
Created February 10, 2012 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save curtismchale/1792678 to your computer and use it in GitHub Desktop.
Save curtismchale/1792678 to your computer and use it in GitHub Desktop.
remove polldaddy from content
/**
* 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