I am creating and developing a custom WordPress theme and I am struggling with one issue, which is making me crazy and I can’t find any fix and can’t figure out, what I am doing wrong…
There is some extra spaces added in output which breaks the layout and creates empty space
here is my source code (index.php):
<div class="c6">
<h4>news</h4>
<?php query_posts('showposts=3'); ?>
<?php if (have_posts()) : while(have_posts()) : the_post(); ?>
<?php get_template_part('content', get_post_format()); ?>
<?php endwhile; else : ?>
<p><?php _e('No posts were found!', 'unqvsn-framework'); ?></p>
<?php endif ?>
<p class="articles-nav-prev"><?php next_posts_link(__('» Older Posts', 'unqvsn-framework')); ?></p>
</div>
and here is also code for the left column sidebar, where it is happening too (as well as for each sidebar I create):
<h4>Line up</h4>
<div class="sidebar"><?php get_sidebar('lineup-sidebar'); ?></div>
and here is the output with inspected code in the browser (Chrome, the same happens in Firefox):
Any ideas?
Thanks
Unwanted white-space can be caused if your files are saved as UTF8.
To fix it, try re-saving the affected files as UTF-8 without BOM, to do this in Notepad++, just go to Encoding-> Encode in UTF-8 without BOM and save.
http://en.wikipedia.org/wiki/Byte_order_mark
What’s different between UTF-8 and UTF-8 without BOM?
One thing you can try is adding html comments in between your php tags to prevent the extra whitespace