Last active
November 18, 2015 16:46
-
-
Save cabans/5d41733dd817a21e2ff7 to your computer and use it in GitHub Desktop.
WordPress - Clean paragraphs in Shortcodes
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
<?php | |
// Move priority of Auto Paragraph function | |
remove_filter( 'the_content', 'wpautop' ); | |
add_filter( 'the_content', 'wpautop' , 12); | |
// Shortcode function | |
function shortcode_function( $atts, $content ) { | |
// Clean spaces and add paragraphs | |
$content = wpautop(trim($content)); | |
return $content; | |
} | |
add_shortcode( 'no-paragraphs', 'shortcode_function' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment