1 post
  • 4 Years of Membership
  • Affiliate Level 1
  • Bulgaria
  • Collector Level 2
biosynthetic
says

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

1763 posts How's the surf doing?
  • Power Elite Author
  • Trendsetter
  • Top Monthly Author
  • Community Superstar
+10 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.

46 posts
  • Author Level 8
  • Elite Author
  • Exclusive Author
  • Collector Level 2
+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

1565 posts
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 2
  • Featured Author
+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?
46 posts
  • Author Level 8
  • Elite Author
  • Exclusive Author
  • Collector Level 2
+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..

1565 posts
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 2
  • Featured Author
+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
  • 4 Years of Membership
  • Author Level 3
  • Collector Level 2
  • Exclusive Author
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
  • Affiliate Level 1
  • Author Level 5
  • Romania
  • Collector Level 1
+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?

689 posts
  • Affiliate Level 3
  • Author Level 6
  • Beta Tester
  • Collector Level 4
+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
  • Bundle Boss
  • Most Wanted Winner
  • Author Level 5
  • 6 Years of Membership
+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.

by
by
by
by
by
by