97 posts
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Made it to the Authors' Hall of Fame
  • Located in Finland
+4 more
Smuliii says

Hello everybody!

One of my WP theme got soft disabled about a month ago, and now when I finally have some time to take a look at it (and try to fix the issue), they still won’t approve it.

So, the original reason was: “Please make sure you’re not stripping out any native functionality like wpautop and wptexturize.” And that’s fine, I totally understand this.

But can you tell me why this isn’t okay, since this will affect only in user-selected area (so it won’t break any plugins).
function ss_framework_shortcode_fixer( $content ) {

    $new_content = '';
    $pattern_full = '{(\[raw\].*?\[/raw\])}is';
    $pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
    $pieces = preg_split( $pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE );

    $unwanted_tags = array(
        '<p>['    => '[',
        ']</p>'   => ']',
        ']<br />' => ']'
    );

    foreach ( $pieces as $piece ) {

        if ( preg_match( $pattern_contents, $piece, $matches ) ) {
            $new_content .= strtr( $matches[1], $unwanted_tags );
        } else {
            $new_content .= $piece;
        }

    }

    return $new_content;

}
add_filter('the_content', 'ss_framework_shortcode_fixer');

The review has recommended this method, but unfortunately it doesn’t strip every empty p tag: http://www.viper007bond.com/2009/11/22/wordpress-code-earlier-shortcodes/

97 posts
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Made it to the Authors' Hall of Fame
  • Located in Finland
+4 more
Smuliii says

Does anyone have any alternative solutions or suggestions?

1702 posts Multimedia Artistry
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 3 years
  • Contributed a free file of the month
  • Won a Most Wanted contest
+4 more
dnp_theme says

I think some jQuery could do:

  $(document).ready(function() {
  $('p:empty').remove();
 });
4 posts
  • Has collected 100+ items on Envato Market
  • Has been part of the Envato Community for over 4 years
  • Located in United States
MiloHoffman00 says

are you able to email us buyers or something a new download version of the theme?

19 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Has referred 100+ members
  • Made it to the Authors' Hall of Fame
+3 more
webcreations907 says

Maybe there are plugins that users might install that need the p wrapping and stray p spitting that wpautop produces.

What if you only apply that function of yours above to your shortcodes and leave the rest for the p tag party, then maybe TF would see it as acceptable?

707 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+2 more
ChillThemes says

Maybe there are plugins that users might install that need the p wrapping and stray p spitting that wpautop produces. What if you only apply that function of yours above to your shortcodes and leave the rest for the p tag party, then maybe TF would see it as acceptable?

I, and others have done that in the past and they still rejected it. So I just stopped adding overly complex shortcodes in my theme. Besides, there’s plenty of plugins readily available.

19 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,000+ on Envato Market
  • Has referred 100+ members
  • Made it to the Authors' Hall of Fame
+3 more
webcreations907 says


Maybe there are plugins that users might install that need the p wrapping and stray p spitting that wpautop produces. What if you only apply that function of yours above to your shortcodes and leave the rest for the p tag party, then maybe TF would see it as acceptable?
I, and others have done that in the past and they still rejected it. So I just stopped adding overly complex shortcodes in my theme. Besides, there’s plenty of plugins readily available.
What if it was a user optional function in like theme options panel or somewhere?

if(user_wants_to_use_function){
do function...
}else{
feeling lucky?....
}

97 posts
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Made it to the Authors' Hall of Fame
  • Located in Finland
+4 more
Smuliii says

I think some jQuery could do:
  $(document).ready(function() {
  $('p:empty').remove();
 });

Yeah I guess, but why I should use JS when I just could use PHP in the first place. That method would also remove all the empty paragraphs, and I certainly don’t want to do that.


are you able to email us buyers or something a new download version of the theme?

No, there isn’t any way to email buyers.


Maybe there are plugins that users might install that need the p wrapping and stray p spitting that wpautop produces. What if you only apply that function of yours above to your shortcodes and leave the rest for the p tag party, then maybe TF would see it as acceptable?

The “funny” thing is that’s exactly what my code does. So if user doesn’t add [raw] shortcode to any page, the function does absolutely nothing. So what, do I now need to create a plugin and tell every buyer to install it… :S


I, and others have done that in the past and they still rejected it. So I just stopped adding overly complex shortcodes in my theme. Besides, there’s plenty of plugins readily available.

Unfortunately even a few of the most simple ones sometimes “breaks” (there seems to be no logic when they work properly and when they don’t):

PHP:
function ss_framework_infobox_sc( $atts, $content = null ) {
    return '<div class="infobox">' . do_shortcode( $content ) . '</div>';
}
WP editor (HTML mode):
[infobox]<h3>It’s an info box! Your title goes here.</h3>[/infobox]
HTML output:
<div class="infobox">
<br />
<h3>It’s an info box! Your title goes here.</h3>
<p>
</p></div>
220 posts The Joomla Guy
  • Power Elite Author: Sold more than $1M on Envato Market
  • Won a competition
  • Had an item featured on Envato Market
  • Made it to the Authors' Hall of Fame
+9 more
hogash says
97 posts
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Made it to the Authors' Hall of Fame
  • Located in Finland
+4 more
Smuliii says

Hey Smulii, perhaps this could help http://themeforest.net/forums/thread/empty-p-tags-when-using-shortcodes/48520 ?

I found the original [raw] shortcode in there (which removes wpautop & wptexturize), but that’s pretty much it.

by
by
by
by
by
by