Eliminating extra space when using a shortcode

I have a shortcode in a text widget in the sidebar:

[s2If is_user_logged_in() AND current_user_is(s2member_level0)]...[/s2If]

When the text is not displayed (i.e. when both of the conditions are not met) there is still a bit of space in the sidebar where the text would have been. It’s not a lot, maybe a line’s worth, but it’s enough to throw off the alignment of that sidebar with the rest of the content on the site. Any idea how to get rid of this space? Thanks.

Hi Philip.

Maybe your editor is adding the space…? What editor are you using?

if you test closing the s2If on the same line that you open it, do you get that empty space? And in the page, do you see what HTML was added there that causes the empty space? e.g.  

Thanks. I realized my mistake. The code was in its own widget. Therefore the widget itself is the space. Even an empty widget takes up some space.

1 Like