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’ );

1700 posts How's the surf doing?
  • Power Elite Author: Sold more than $1M on Envato Market
  • Has sold $1M+ on Envato Market and is now a Power Elite Author
  • Achieved the monthly Community Superstar Award
  • Made it to the Authors' Hall of Fame
+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
+1 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

1542 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
+2 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
+1 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..

1542 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
+2 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
  • Sells items exclusively on Envato Market
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!

275 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Located in Romania
  • Has collected 1+ items 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?

656 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.

554 posts
  • Had an item featured in an Envato Bundle
  • Won a Most Wanted contest
  • Has sold $10,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
+4 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.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by