97 posts
  • Bought between 10 and 49 items
  • Elite Author
  • Exclusive Author
  • Finland
  • Has been a member for 5-6 years
  • Referred between 100 and 199 users
  • Sold between 250 000 and 1 000 000 dollars
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
  • Bought between 10 and 49 items
  • Elite Author
  • Exclusive Author
  • Finland
  • Has been a member for 5-6 years
  • Referred between 100 and 199 users
  • Sold between 250 000 and 1 000 000 dollars
Smuliii says

Does anyone have any alternative solutions or suggestions?

1644 posts Multimedia Artistry
  • Author had a Free File of the Month
  • Has been a member for 3-4 years
  • Referred between 100 and 199 users
  • Bought between 10 and 49 items
  • Exclusive Author
  • Most Wanted Bounty Winner
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
dnp_theme says

I think some jQuery could do:

  $(document).ready(function() {
  $('p:empty').remove();
 });
4 posts
  • Bought between 100 and 499 items
  • Has been a member for 4-5 years
  • 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 between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Bought between 100 and 499 items
  • Referred between 50 and 99 users
  • Has been a member for 2-3 years
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
  • Sold between 10 000 and 50 000 dollars
  • Referred between 10 and 49 users
  • Bought between 10 and 49 items
  • Has been a member for 5-6 years
  • Exclusive Author
  • Microlancer Beta Tester
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 between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Bought between 100 and 499 items
  • Referred between 50 and 99 users
  • Has been a member for 2-3 years
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
  • Bought between 10 and 49 items
  • Elite Author
  • Exclusive Author
  • Finland
  • Has been a member for 5-6 years
  • Referred between 100 and 199 users
  • Sold between 250 000 and 1 000 000 dollars
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>
170 posts The Joomla Guy
  • Won a Competition
  • Power Elite Author
  • Power Elite Author: Sold between 1 000 000 - 1 999 999 dollars
  • Most Wanted Bounty Winner
  • Bought between 100 and 499 items
  • Referred between 500 and 999 users
  • Has been a member for 4-5 years
+4 more
hogash says
97 posts
  • Bought between 10 and 49 items
  • Elite Author
  • Exclusive Author
  • Finland
  • Has been a member for 5-6 years
  • Referred between 100 and 199 users
  • Sold between 250 000 and 1 000 000 dollars
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