1 post
  • Has been part of the Envato Community for over 3 years
  • Has referred 1+ members
  • Located in Bulgaria
  • Has collected 10+ items on Envato Market
biosynthetic says

Try remove_filter( ‘the_content’, ‘wpautop’ );

1386 posts How's the surf doing?
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+6 more
tommusrhodus says

Try remove_filter( ‘the_content’, ‘wpautop’ );

This is exactly what cannot be done and will be an instant reject for any submitted theme, and for good reason as well. The replays further up this thread give much safer functions for cleaning short codes than simply disabling all of wpautop.

41 posts
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Has collected 10+ items on Envato Market
+2 more
EngineThemes says

this code is not accepted anymore..

add_filter("the_content", "the_content_filter"); 
    function the_content_filter($content) {     
        $block = join("|",array("alert","blockquote","a","ul","li","dropcap","columns","image","tabgroup","tab","toggle","video","googlemap"));     
        // opening tag
        $rep = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br />)?/","[$2$3]",$content);            
        // closing tag
        $rep = preg_replace("/(</p><p>)?\[\/($block)](<\/p>|<br />)?/","[/$2]",$rep);     
        return $rep;     
    }
</p>

any good alternate solution to this? :)

thanks

1485 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+3 more
OriginalEXE says

this code is not accepted anymore..
add_filter("the_content", "the_content_filter"); 
    function the_content_filter($content) {     
        $block = join("|",array("alert","blockquote","a","ul","li","dropcap","columns","image","tabgroup","tab","toggle","video","googlemap"));     
        // opening tag
        $rep = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br />)?/","[$2$3]",$content);            
        // closing tag
        $rep = preg_replace("/(</p><p>)?\[\/($block)](<\/p>|<br />)?/","[/$2]",$rep);     
        return $rep;     
    }
</p>

any good alternate solution to this? :)

thanks
Hmm, did you explain to reviewer that this only affects your own shortcodes?
41 posts
  • Has sold $125,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Has collected 10+ items on Envato Market
+2 more
EngineThemes says


this code is not accepted anymore..
add_filter("the_content", "the_content_filter"); 
    function the_content_filter($content) {     
        $block = join("|",array("alert","blockquote","a","ul","li","dropcap","columns","image","tabgroup","tab","toggle","video","googlemap"));     
        // opening tag
        $rep = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br />)?/","[$2$3]",$content);            
        // closing tag
        $rep = preg_replace("/(</p><p>)?\[\/($block)](<\/p>|<br />)?/","[/$2]",$rep);     
        return $rep;     
    }
</p>

any good alternate solution to this? :)

thanks
Hmm, did you explain to reviewer that this only affects your own shortcodes?

No..

1485 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+3 more
OriginalEXE says

Well try.

That happened to team I work in too, and from then a detailed explanation about it is always included in reviewers note and it passed every time (last update we pushed was 14 days ago).

11 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Located in Europe
+1 more
Matyushen says

So, if there any proved solution for this? Last mentioned solution does not work at all for some reason. Get this:

Warning: preg_replace() [function.preg-replace]: Unknown modifier '>'
Warning: preg_replace() [function.preg-replace]: Unknown modifier 'p'

Only this does the trick:

add_filter('the_content', 'shortcode_empty_paragraph_fix');
    function shortcode_empty_paragraph_fix($content) {   
      $array = array (
        '<p>[' => '[', 
        ']</p>' => ']', 
        ']<br />' => ']'
      );
      $content = strtr($content, $array);
      return $content;
    }

But some tell it wont get through. Could anybody recommend any solution for clearing few shrotcodes from p and br tags? Thanks!

252 posts
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
+3 more
DanThemes says

This code is no longer accepted by reviewers:

add_filter('the_content', 'shortcode_empty_paragraph_fix');
function shortcode_empty_paragraph_fix($content)
{   
    $array = array (
        '<p>[' => '[', 
        ']</p>' => ']', 
        ']<br />' => ']'
    );

    $content = strtr($content, $array);

    return $content;
}

What do you guys use instead of it?

633 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+5 more
UBLThemes says

This code is no longer accepted by reviewers:
add_filter('the_content', 'shortcode_empty_paragraph_fix');
function shortcode_empty_paragraph_fix($content)
{   
    $array = array (
        '<p>[' => '[', 
        ']</p>' => ']', 
        ']<br />' => ']'
    );

    $content = strtr($content, $array);

    return $content;
}
What do you guys use instead of it?

We use this instead this little nifty function thanks to bitfade:

https://gist.github.com/bitfade/4555047

This is used because you are only using on your shortcodes so that any 3rd party shortcodes are not affected by this which is why the other code is not allowed, because it also effects 3rd party plugins.

368 posts
  • Has referred 50+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+5 more
QBKL says

For empty <p> tags in my own shortcodes I’d use CSS3 :empty pseudo to style or display: none. Works in all modern browsers. ie9+, chrome, etc and mobile.

Sure, in IE8 you’d have some minor discrepancies, but as long as the column structure and stuff like that doesn’t break, I believe it’s a technique worth using over JS or interfering with the_content filter.

by
by
by
by
by
by