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/
Does anyone have any alternative solutions or suggestions?
I think some jQuery could do:
$(document).ready(function() {
$('p:empty').remove();
});
are you able to email us buyers or something a new download version of the theme?
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?
webcreations907 said
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.
itsmattadams saidWhat if it was a user optional function in like theme options panel or somewhere?
webcreations907 saidI, 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.
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?
if(user_wants_to_use_function){
do function...
}else{
feeling lucky?....
}
dnp_theme said
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.
MiloHoffman00 said
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.
webcreations907 said
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… 
itsmattadams said
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>
- Sold between 250 000 and 1 000 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Most Wanted Bounty Winner
- Bought between 100 and 499 items
- Referred between 200 and 499 users
- Romania
Hey Smulii, perhaps this could help http://themeforest.net/forums/thread/empty-p-tags-when-using-shortcodes/48520 ?
hogash said
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.
