Support » Themes and Templates » Spacing Help?

  • Resolved Emi


    I have been working on my own custom theme and it is essentially all done except for one minor problem… The spacing for the posts themselves.

    Link to blog:

    On the left side are where the posts are, but for some reason, the layout seems to be really picky with linebreaks. I often have to type 3 or 4 of them for it to finally put a space for paragraphs in the entries and as you can probably see, the “Posted by” is DIRECTLY under the Tags rather than there being a hard-return inbetween the two.

    Does anyone know what coding I can add to fix this? I’ve tried doing some modifications with no luck and it’s really annoying.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Ryan Cowles


    Hi Emi,

    Nice work on creating a custom theme!

    From the looks of things, you should be able to modify the CSS to add a margin above and/or below the *Posted by…” paragraph. The paragraph’s class is postmetadetaw, so you can use that to style it. For example, this will add a 6px margin above and below the “Posted by…” paragraph:

    .postmetadataw {
    	margin: 6px 0;

    Where else are you experiencing issues with the linebreaks? If it is in the actual post content, it may be due to the wpautop function. This function automatically adds some formatting to WordPress posts and pages. If you want to remove this auto formatting, you can add the following line in your theme’s functions.php file:

    remove_filter('the_content', 'wpautop'); // Remove auto formatting from posts/pages
    remove_filter('the_excerpt', 'wpautop'); // Remove auto formatting from excerpts

    David Walsh wrote a more comprehensive solution on his blog as well. You can check it out here:

    Note: Since you created this theme, you can modify the functions.php file directly if you would like. If you were editing an existing theme, you would want to do this in a child theme.



    Font hero

    Few things going on, first you got this comming out from the thickbox.css

    * {margin:0;padding:0;}

    So, It’s not really the issue of spacing between the post, but rather the missing proper margins in typography. Because you have that line in the CSS, you lose the browser’s default stylings.

    Try this CSS

    p {margin:1em 0;}{margin:1.5em 0;}

    and see the different, then you’ll get the idea.

    The point is to get rid of that bit comming out from thickbox.css, theme don’t need that css outside of thickbox, so whatever reason why it loads in the theme, just fix that, and your theme will use default browsers styling, and then you can adjust some elements with margin to fit your need.

    Thank you both 🙂 That seems to have fixed it!

    Ryan Cowles


    Glad you got it working. Nice catch, Paul!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Spacing Help?’ is closed to new replies.