1 post
  • Bought between 10 and 49 items
  • Bulgaria
  • Has been a member for 2-3 years
  • Referred between 1 and 9 users
biosynthetic says

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

1174 posts How's the surf doing?
  • Forum Superstar
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • United Kingdom
  • Referred between 200 and 499 users
  • Exclusive Author
  • Has been a member for 3-4 years
+2 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
  • Exclusive Author
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 3-4 years
  • Bought between 10 and 49 items
  • Europe
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

1465 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
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
  • Exclusive Author
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 3-4 years
  • Bought between 10 and 49 items
  • Europe
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..

1465 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
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
  • Bought between 10 and 49 items
  • Europe
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 1 000 and 5 000 dollars
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!

198 posts
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 5 000 and 10 000 dollars
  • Romania
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?

631 posts
  • United Kingdom
  • Sold between 10 000 and 50 000 dollars
  • Most Wanted Bounty Winner
  • Interviewed on the Envato Notes blog
  • Referred between 50 and 99 users
  • Bought between 50 and 99 items
  • Envato Studio (Microlancer) Beta Tester
  • Exclusive Author
  • Has been a member for 2-3 years
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.

321 posts
  • Envato Studio (Microlancer) Beta Tester
  • Most Wanted Bounty Winner
  • Author had a File in an Envato Bundle
  • Has been a member for 5-6 years
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
  • Romania
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