57 posts
  • Elite Author
  • Trendsetter
  • Author Level 8
  • Collector Level 3
+4 more
ab-themes
says
Is this way of stripping empty p tags on specific shortcodes allowed?
https://gist.github.com/bitfade/4555047
Tnx!
1763 posts How's the surf doing?
  • Power Elite Author
  • Trendsetter
  • Top Monthly Author
  • Community Superstar
+10 more
tommusrhodus
says
jQuery(document).ready(function(){ jQuery('p:empty').remove(); });
148 posts
  • 2 Years of Membership
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
  • 1 Year of Membership
  • Affiliate Level 1
  • Author Level 3
  • Collector Level 2
+2 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.

382 posts
  • Weekly Top Seller
  • Elite Author
  • Author Level 8
  • New Zealand
+6 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
  • 2 Years of Membership
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?

57 posts
  • Elite Author
  • Trendsetter
  • Author Level 8
  • Collector Level 3
+4 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..

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

57 posts
  • Elite Author
  • Trendsetter
  • Author Level 8
  • Collector Level 3
+4 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 :)
by
by
by
by
by
by