562 posts You Reap What You Saw
  • Weekly Top Seller
  • Elite Author
  • Author Level 7
  • 5 Years of Membership
+4 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
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 3
  • Collector Level 3
+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
  • Weekly Top Seller
  • Elite Author
  • Author Level 7
  • 5 Years of Membership
+4 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
  • 6 Years of Membership
  • Affiliate Level 2
  • Author Level 3
  • Collector Level 3
+2 more
jayjdk
says

Great! Glad I could help :)

111 posts
  • Top Monthly Author
  • Trendsetter
  • Weekly Top Seller
  • Affiliate Level 7
+8 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
  • Collector Level 2
  • Exclusive Author
  • 5 Years of Membership
Web_Plus
says

That tip really helped ! Thanks.

by
by
by
by
by
by