562 posts You Reap What You Saw
  • Has referred 200+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 1+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+3 more
Bluz says

I’v started learning about wordpress shortcodes but After I create some shortcodes and uses it in wordpress. It gives me an extra break tag that I never wanted to get. This causes layout issues.

Is there any solution?

Here is an example of a simple shortcode I use and how it look after I’m using it:

The shortcode:
function OneThird($atts, $content = null ) {
    return '<div class="one_third">' . do_shortcode($content) . '</div>';
}
add_shortcode("one_third", "OneThird");
This shortcodes become in html:
<div class="one_third"></div>
<br />

I DON ’T WANT THE BREAK TAG ! :( This issue is actually stopping me from releasing a new wordpress theme.

122 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
+2 more
jayjdk says

The post editor adds < br / > – Do you have an empty line after the shortcode?

562 posts You Reap What You Saw
  • Has referred 200+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 1+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+3 more
Bluz says
The post editor adds < br / > – Do you have an empty line after the shortcode?

No I didn’t had an empty line. But after having an empty line between shortcodes the BR disappeared! Thanks Man :D

122 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 50+ items on Envato Market
+2 more
jayjdk says

Great! Glad I could help :)

109 posts
  • Has referred 1000+ members
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has collected 50+ items on Envato Market
  • Made it to the Authors' Hall of Fame
+5 more
elemis says

The post editor adds < br / > – Do you have an empty line after the shortcode?
No I didn’t had an empty line. But after having an empty line between shortcodes the BR disappeared! Thanks Man :D

OMG ! Can’t believe such a simple thing works! Thanks to both of you :D

1 post
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
  • Has been part of the Envato Community for over 4 years
Web_Plus says

That tip really helped ! Thanks.

by
by
by
by
by
by