51 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Sells items exclusively on Envato Market
+3 more
ab-themes says
Is this way of stripping empty p tags on specific shortcodes allowed?
https://gist.github.com/bitfade/4555047
Tnx!
1584 posts How's the surf doing?
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 3 years
  • Had an item featured on Envato Market
  • Made it to the Authors' Hall of Fame
+6 more
tommusrhodus says
jQuery(document).ready(function(){ jQuery('p:empty').remove(); });
148 posts
  • Has been part of the Envato Community for over 1 year
loveetc says

jQuery(document).ready(function(){ jQuery('p:empty').remove(); });

That’s very ugly way to do that. You should use remove those tags in shortcodes properly without messing with WordPress core code.

1 post
  • Has been part of the Envato Community for over 1 year
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+1 more
MasonThemes says


jQuery(document).ready(function(){ jQuery('p:empty').remove(); });
That’s very ugly way to do that. You should use remove those tags in shortcodes properly without messing with WordPress core code.

^^That doesn’t touch the core..

Whilst I admit it’s not the most elegant solution in the world, it certainly does exactly what is required without having to filter the_content output in any way.

371 posts
  • Has referred 50+ members
  • Has sold $125,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+5 more
PixelStores says

I believe its allowed as long as you don’t remove the two filters, wpautop and wptexturize, like the code below.

remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');

~ Matt

148 posts
  • Has been part of the Envato Community for over 1 year
loveetc says



jQuery(document).ready(function(){ jQuery('p:empty').remove(); });
That’s very ugly way to do that. You should use remove those tags in shortcodes properly without messing with WordPress core code.

^^That doesn’t touch the core..

Whilst I admit it’s not the most elegant solution in the world, it certainly does exactly what is required without having to filter the_content output in any way.

Sure, it doesn’t, but I said you can use the code which can do that more efficiently. Why to first make mess and then clean up with extra js code? Why not doing it clean way at first place?

51 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Sells items exclusively on Envato Market
+3 more
ab-themes says

In WordPress Theme Submission Requirements says:
Modification of filters in wptexturize() is not allowed.
Modification of filters in wpautop is not allowed.

And that are only two points regarding filtering, so i would say bitfade’s code is allowed..

jQuery is easy way, but i don’t like to echo something and then hide it, in my opinion it is much better to filter content, especially with bitfade’s code as it doesn’t mess up anything besides my shortcodes..

1584 posts How's the surf doing?
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 3 years
  • Had an item featured on Envato Market
  • Made it to the Authors' Hall of Fame
+6 more
tommusrhodus says

Sure, it doesn’t, but I said you can use the code which can do that more efficiently. Why to first make mess and then clean up with extra js code? Why not doing it clean way at first place?

Don’t get me wrong, I totally agree, but either way you’re just trying to clean up the mess that WordPress outputs by default, one way involves removing the dead tags from the DOM (jQuery) and the other involves filtering the entire content (PHP) – whilst I agree that the PHP way is definitely neater, the jQuery method is certainly more comprehensive.

501 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 more
pixelentity says

Our latest theme which includes the mentioned code was held for a few days because of it. It was ultimately confirmed by the review team that it can be used and the theme was approved as is.

51 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Sells items exclusively on Envato Market
+3 more
ab-themes says

Our latest theme which includes the mentioned code was held for a few days because of it. It was ultimately confirmed by the review team that it can be used and the theme was approved as is.
The bitfade’s code i asked for or jQuery code?

I tried both solutions for some time, and now i like jQuery more :)

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