37 posts
  • Europe
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Grew a moustache for the Envato Movember competition
  • Has been a member for 2-3 years
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
ab-themes says
Is this way of stripping empty p tags on specific shortcodes allowed?
https://gist.github.com/bitfade/4555047
Tnx!
945 posts How's the surf doing?
  • 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 2-3 years
  • Microlancer Beta Tester
+1 more
tommusrhodus says
jQuery(document).ready(function(){ jQuery('p:empty').remove(); });
148 posts
  • Has been a member for 0-1 years
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
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 0-1 years
  • Sold between 1 000 and 5 000 dollars
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.

360 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Has been a member for 4-5 years
  • New Zealand
  • Referred between 10 and 49 users
  • Bought between 10 and 49 items
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
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 a member for 0-1 years
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?

37 posts
  • Europe
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Grew a moustache for the Envato Movember competition
  • Has been a member for 2-3 years
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
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..

945 posts How's the surf doing?
  • 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 2-3 years
  • Microlancer Beta Tester
+1 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.

488 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Referred between 1000 and 1999 users
  • Author had a Free File of the Month
  • Author had a File in an Envato Bundle
  • Bought between 10 and 49 items
+3 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.

37 posts
  • Europe
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Grew a moustache for the Envato Movember competition
  • Has been a member for 2-3 years
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
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 :)
by
by
by
by
by
by