wpautop messing with output?
-
Hi,
I ran into small problems when using this plugin on my site. I had a WordPress image gallery (inserted with gallery shortcode) inside a column. The output was full of annoying p and br tags just about after each tag. Also text content in another column in the same group had extra br tags in it. However, if I removed the column shortcodes, the output was ok (but missed columns, of course).
I looked into the plugin’s code, and to me, the problems described in this article seemed to be affecting the plugin’s output. I modified the plugin with help of that article and managed to get rid of those extra br and p tags.
I changed the constructor to:
function __construct() { add_filter( 'the_content', array($this, 'columns_preprocess_shortcode'), 7 ); add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); }
Then in
columns_preprocess_shortcode
I put this:function columns_preprocess_shortcode( $content ) { global $shortcode_tags; $original_shortcode_tags = $shortcode_tags; $shortcode_tags = array(); add_shortcode( 'column', array( $this, 'column' ) ); add_shortcode( 'column-group', array( $this, 'group' ) ); $content = do_shortcode($content); $shortcode_tags = $original_shortcode_tags; return $content; }
I also removed the call to wpautop in method
column
(why is it called there? Is it assumed that user has removedwpautop
filter for content altogether?)There was also a part about adding dummy shortcodes in the article. I couldn’t get it to work for some reason. I just managed to erase all content. I guess I’ll need to look into it if I run into problems with stripping shortcodes from content (explained in the article).
Aren’t these necessary changes to prevent “
wpautop
and the likes” from processing the plugin’s output before the plugin’s shortcodes are executed?
- The topic ‘wpautop messing with output?’ is closed to new replies.