WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Spacing Help? (5 posts)

  1. Emi
    Member
    Posted 1 year ago #

    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: http://pinkwaters.crystal-dreams.us/

    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.

  2. Ryan Cowles
    Member
    Posted 1 year ago #

    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: http://davidwalsh.name/disable-autop

    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.

  3. paulwpxp
    Font hero
    Posted 1 year ago #

    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;}
    h2.post-title{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.

  4. Emi
    Member
    Posted 1 year ago #

    Thank you both :) That seems to have fixed it!

  5. Ryan Cowles
    Member
    Posted 1 year ago #

    Glad you got it working. Nice catch, Paul!

Topic Closed

This topic has been closed to new replies.

About this Topic