562 posts You Reap What You Saw
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has been part of the Envato Community for over 5 years
  • Contributed a free file of the month
+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
  • 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
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has been part of the Envato Community for over 5 years
  • Contributed a free file of the month
+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
  • 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 :)

111 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.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by