ThemeForest

Shortcodes and wpautop()

384 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Won a Competition
  • Referred between 500 and 999 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
1422 posts
  • Microlancer Beta Tester
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 000 and 250 000 dollars
+2 more
ZoomIt says
http://wpforce.com/prevent-wpautop-filter-shortcode/

“ThemeForest theme developers in particular seem to love adding this code to their themes.” – lol

2079 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 10 and 49 items
  • Referred between 200 and 499 users
  • Has been a member for 4-5 years
  • Won a Competition
+10 more
mpc moderator says

Thanks guys I have fixed it on my own ;P But for the next theme I will probably use the provided snippet.

1422 posts
  • Microlancer Beta Tester
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 000 and 250 000 dollars
+2 more
ZoomIt says

Would be nice to provide the fix since you started the thread and others may be intersted :d

149 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 2-3 years
  • Referred between 1 and 9 users
  • Sold between 10 000 and 50 000 dollars
  • Spain
IulianN says

Would be nice to provide the fix since you started the thread and others may be intersted :d

+1 for this and up we go :)

349 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Most Wanted Bounty Winner
  • Bought between 10 and 49 items
  • Exclusive Author
  • Referred between 10 and 49 users
  • Has been a member for 2-3 years
+1 more
LCweb says

I had a very strange issue with empty paragraphs and spaces in the the shortcode of my last plugin.
I tried a lot of solution posted by authors here in the past months, but the only thing that solved it was this piece of code:

$data = shortcode content ..
$data= str_replace(array("\r", "\n", "\t", "\v"), '', $data);
return $data;

I don’t know if is the best way, but it works :D

179 posts
  • Microlancer Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 10 and 49 users
  • Exclusive Author
  • Europe
  • Has been a member for 2-3 years
cosmincotor says

I’m also looking for a bulletproof solution, so if anyone has it, please share it with us :)

679 posts
  • Attended a Community Meetup
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 3-4 years
  • Most Wanted Bounty Winner
  • Referred between 500 and 999 users
+2 more
mordauk says

Bulletproof solution: do not any of this. This kind of behavior should only ever be done in plugins.

These kind of snippets literally cause me and many other plugin developers dozens or hundreds of hours in support requests.

349 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Most Wanted Bounty Winner
  • Bought between 10 and 49 items
  • Exclusive Author
  • Referred between 10 and 49 users
  • Has been a member for 2-3 years
+1 more
LCweb says

Bulletproof solution: do not any of this. This kind of behavior should only ever be done in plugins. These kind of snippets literally cause me and many other plugin developers dozens or hundreds of hours in support requests.

Indeed. Probably my issue was caused by one of them, since on the Twenty Eleven theme everything was fine.

179 posts
  • Microlancer Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 10 and 49 users
  • Exclusive Author
  • Europe
  • Has been a member for 2-3 years
cosmincotor says

Bulletproof solution: do not any of this. This kind of behavior should only ever be done in plugins. These kind of snippets literally cause me and many other plugin developers dozens or hundreds of hours in support requests.

It’s true, in most cases these snippets can cause major problems, however without removing those empty p tags the shortcodes won’t work properly, because WordPress adds them all over the place.

So, again, has anyone found a proper way to create shortcodes in a theme, without the use of a plugin, and without affecting other plugins ?

by
by
by
by
by