Title: Extra spacing randomly
Last modified: September 1, 2016

---

# Extra spacing randomly

 *  Resolved [Blutarsky](https://wordpress.org/support/users/blutarsky/)
 * (@blutarsky)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/extra-spacing-randomly/)
 * Hi there mate, I can’t figure why sometimes the closed accordion item has 1 or
   2 blank lines.
 * For example:
    [here](http://me-about.me/test/academics/subjects/gym/#mytop), 
   just no blank lines
 * [here](http://me-about.me/test/academics/curriculum/early-years/#mytop), each
   accordion item has one empty line
 * [here](http://me-about.me/test/academics/curriculum/key-stage-1/#mytop), only
   the first accordion item has one blank line….
 * scroll down almost to the end of page….
 * [https://wordpress.org/plugins/accordion-shortcodes/](https://wordpress.org/plugins/accordion-shortcodes/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [Blutarsky](https://wordpress.org/support/users/blutarsky/)
 * (@blutarsky)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/extra-spacing-randomly/#post-7549952)
 * I have edited the pages above so they don’t reflect what I wrote.
 * [See this](http://prntscr.com/bsfhuh) to summarize problem
 *  Plugin Author [philbuchanan](https://wordpress.org/support/users/philbuchanan/)
 * (@philbuchanan)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/extra-spacing-randomly/#post-7549954)
 * WordPress automatically adds spaces around shortcodes. So if you don’t set things
   up perfectly you can often see things like that. Putting this function in your
   themes `functions.php` file should fix it.
 *     ```
       /**
        * Fixes empty <p> and <br> tags showing before and after shortcodes in the
        * output content.
        */
       function pb_the_content_shortcode_fix($content) {
       	$array = array(
       		'<p>['    => '[',
       		']</p>'   => ']',
       		']<br />' => ']',
       		']<br>'   => ']'
       	);
       	return strtr($content, $array);
       }
       add_filter('the_content', 'pb_the_content_shortcode_fix');
       ```
   
 *  Thread Starter [Blutarsky](https://wordpress.org/support/users/blutarsky/)
 * (@blutarsky)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/extra-spacing-randomly/#post-7549957)
 * Thank you very much mate 🙂
 * Your fix did not work, but I have forced the text to have no spaces or breaks
   between accordion items and now it works.
 * The text is not so readable now but it works. Since then you have to avoid the
   visual editor that will rearrange text.
 * How do you visually code the accordion items? Can you write down a sample?
 * Thanks again
 *  Plugin Author [philbuchanan](https://wordpress.org/support/users/philbuchanan/)
 * (@philbuchanan)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/extra-spacing-randomly/#post-7549967)
 * Here is a sample of how I write them. I do have the function above in my `functions.
   php` file as well.
 *     ```
       [accordion]
   
       [accordion-item title="First Accordion Item"]
   
       This is item number one.
   
       [/accordion-item][accordion-item title="Accordion item two"]
   
       This is item number two.
   
       [/accordion-item][accordion-item title="Third accordion item"]
   
       This is item number three.
   
       [/accordion-item][accordion-item title="Fourth accordion item"]
   
       This is item number four.
   
       [/accordion-item][accordion-item title="A fifth item"]
   
       This is item number five.
   
       [/accordion-item]
   
       [/accordion]
       ```
   
 *  Thread Starter [Blutarsky](https://wordpress.org/support/users/blutarsky/)
 * (@blutarsky)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/extra-spacing-randomly/#post-7549969)
 * Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Extra spacing randomly’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/accordion-shortcodes.svg)
 * [Accordion Shortcodes](https://wordpress.org/plugins/accordion-shortcodes/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/accordion-shortcodes/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/accordion-shortcodes/)
 * [Active Topics](https://wordpress.org/support/plugin/accordion-shortcodes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/accordion-shortcodes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/accordion-shortcodes/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Blutarsky](https://wordpress.org/support/users/blutarsky/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/extra-spacing-randomly/#post-7549969)
 * Status: resolved