Warning: number_format() expects parameter 1 to be float, string given in /home/customer/www/bobbingwidewebdesign.com/public_html/wp-includes/functions.php on line 412
There is a bug in WordPress associated with unwanted breaks (<br />) being created after shortcode expansion which causes formatting problems. This post attempts to document a number of possible workarounds. The bug is documented at http://core.trac.wordpress.org/ticket/14050 The current WordPress documentation for shortcodes says this bug was fixed in WordPress 2.5.1 (we’re now at version 3.0.5). Here is the relevant text
wpautop recognizes shortcode syntax and will attempt not to wrap p or br tags around shortcodes that stand alone on a line by themselves. Note: in WordPress 2.5.0, shortcodes were parsed before post formatting was applied, so the shortcode output HTML was sometimes wrapped in p or br tags. This was incorrect behaviour that has been fixed in 2.5.1.The problem is particularly annoying to me, as I spent a couple of hours trying to work out where the extra <br />’s were coming from in my most recent post prior to this one ( Summary of plugins in a [WoW] website )
Expected behaviour
Two shortcodes on the same line remain on the same line. Here we can see [ WoW] and [ oik] on the same line Here we can see [WoW] and oik on the same line
Wrong behaviour
Two shortcodes on separate lines with an unwanted break [ WoW] [ oik] [WoW] oik
OK, this doesn’t look too bad, but in the previous post the shortcodes were formatted as table rows but all the breaks appeared before the table so there was a big vertical gap. Here, let me show you with [ bw_plug name=”oik” table=”y”] thrice.
Plugin name and description | Plugin links | Version, total downloads, last update, tested |
---|---|---|
oik lazy smart shortcodes for your WordPress website | oik | 4.1.1 December 22, 2020 5.6 |
Plugin name and description | Plugin links | Version, total downloads, last update, tested |
---|---|---|
oik lazy smart shortcodes for your WordPress website | oik | 4.1.1 December 22, 2020 5.6 |
Plugin name and description | Plugin links | Version, total downloads, last update, tested |
---|---|---|
oik lazy smart shortcodes for your WordPress website | oik | 4.1.1 December 22, 2020 5.6 |
Workaround 1A
Put the shortcodes side by side: [ WoW][ oik] Put the shortcodes side by side: [WoW]oik
Workaround 1B
All on the same line but with spaces between them as required: [ WoW] [ oik] All on the same line but with spaces between them as required: [WoW] oik
Ineffective Workaround 2
If you want to write them on separate lines for ease of reading [WoW] oik trying leading spaces DOESN’T work.
Ineffective Workaround 3
Trying trailing required spaces doesn’t work either [WoW] oik
The real solution
Either implement the fix provided by the person who found the problem. Thanks aaroncampbell
Or use the wpautop-control plugin to choose on a post by post basis whether or not you want automatic paragraphs and breaks.