Bobbing Wide Web Design Blog

WordPress blog

  • plugins
    • Calendars and Events
      • Calendar plugin
      • The Events Calendar
        • Experiences with the-events-calendar
        • Events calendars on Windows servers
    • Contact forms
      • 6 Contact form WordPress plugins compared
        • Jetpack contact form –

        • Contact Form 7 – [contact-form-7]
        • oik contact form – [bw_contact_form]
    • custom header images
    • Extended Page Lists
    • Featured post widget
    • Galleries and slideshows
      • Fancybox slideshows
      • NextGEN gallery
      • Slideshow gallery pro
      • oik-nivo-slider – [nivo] shortcode for jQuery Nivo slider
        • oik banner image
        • oik-nivo-slider plugin banner
        • oik-nivo-slider banner page 2
      • Slideshow satellite
    • Membership plugins
    • Membership
    • mp3 media player plugins
      • wpaudio-mp3-player – mp3 player
      • audio – HTML 5 mp3 player
    • Page list plugins
    • Rating and voting plugins
    • Redirect plugins
    • Spam checking plugins
    • underConstruction
    • Twitter plugins
      • Twitter feed plugins
    • WordPress Multisite domain mapping
    • WP-table-reloaded
    • How to examples
      • Video
        • Artist on film – Xandrien Thiel
        • Susan Cowe interviewed on Portsmouth Live TV
      • Slideshow Gallery Pro – page 2
      • Slideshow Gallery Pro [ custom=1]
      • [EPL] simplest implementation
      • EPL shortcode and STC Tweet button
  • About
    • About Herb
    • About Bobbing Wide by Caravan
  • Contact us
    • Find us on Google Maps
  • Sitemap
  • All Plugins
  • All Themes
  • Blog
  • _
  • [
  • #
  • A
  • B
  • C
  • D
  • E
  • F
  • G
  • H
  • I
  • J
  • K
  • L
  • M
  • N
  • O
  • P
  • Q
  • R
  • S
  • T
  • U
  • V
  • W
  • X
  • Y
  • Z
You are here: Home / bong / shortcode breaks and WordPress bug #14050

shortcode breaks and WordPress bug #14050


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 descriptionPlugin linksVersion, 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 descriptionPlugin linksVersion, 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 descriptionPlugin linksVersion, 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.

Published: February 21, 2011 | Last updated: February 4, 2015

Filed Under: bong, fob, How NOT to, How to, technobabble, WordPress Tagged With: unautop, wpautop

Component:
Letters: S

About

  • Home
  • About
  • Contact us
  • Sitemap
  • Privacy notice

Contents

  • All Plugins
  • All Themes

Follow Me

Email: herb@bobbingwide.com


Bobbing Wide

Site:  bobbingwidewebdesign.com
© Copyright Bobbing Wide 2010-2021. All rights reserved.


Website designed and developed by Herb Miller of Bobbing Wide
Proudly powered by WordPress and oik-plugins
WordPress 5.6. PHP: 7.2.34. Memory limit: 768M
Bobbing Wide