562 posts You Reap What You Saw
  • Elite Author
  • Sold between 50 000 and 100 000 dollars
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Exclusive Author
  • Referred between 200 and 499 users
  • Bought between 1 and 9 items
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
  • Bought between 50 and 99 items
  • Denmark
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Sold between 1 000 and 5 000 dollars
jayjdk says

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

562 posts You Reap What You Saw
  • Elite Author
  • Sold between 50 000 and 100 000 dollars
  • Has been a member for 4-5 years
  • Author had a Free File of the Month
  • Exclusive Author
  • Referred between 200 and 499 users
  • Bought between 1 and 9 items
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
  • Bought between 50 and 99 items
  • Denmark
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Sold between 1 000 and 5 000 dollars
jayjdk says

Great! Glad I could help :)

109 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Beta Tester
  • Referred between 1000 and 1999 users
  • Bought between 50 and 99 items
  • Has been a member for 6-7 years
  • Exclusive Author
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
  • Exclusive Author
  • Bought between 10 and 49 items
  • Has been a member for 3-4 years
Web_Plus says

That tip really helped ! Thanks.

by
by
by
by
by
by