• Resolved ewokra

    (@ewokra)


    So my question is simple.

    I use a sticky post on my blog to post daily quotes, however the spacing transfers over from the regular post spacing.

    I am wondering if there is a way to change the spacing of JUST the sticky post without affecting every other post as well?

    I know how to edit the spacing of posts, that’s easy, but I am not sure how to set up in the .css to just single out sticky posts.

    You can see what i mean at Blog (yes that is actually the name of my blog…. for now)

Viewing 15 replies - 1 through 15 (of 16 total)
  • Your sticky post seems to have a css id of ‘post-28’ which you can use to style just that particular post.

    <div class="post-28 post type-post status-publish format-standard sticky hentry category-uncategorized" id="post-28">
    			<h2 class="entry-title"><a rel="bookmark" title="Permalink to Daily Musings…" href="https://www.ewokreacharound.com/?p=28">Daily Musings…</a></h2>
    <p>“<strong>I’M SIGNIFIGANT!</strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Screamed the dust speck.”</p>
    <p style="text-align: right;"><em>-Calvin</em></p>
    
    		<p class="date">February 22, 2011&nbsp;&nbsp;<a title="Comment on Daily Musings…" href="https://www.ewokreacharound.com/?p=28#respond">Leave a comment</a></p>
    </div>

    on the home page, the sticky post has the post_class .sticky which you can use to style the spacing.

    That’s fine if you only have one sticky post showing, to use a more targeted approach you should use the post ID.

    If you are only ever going to have one sticky post on the front page then either will do.

    Thread Starter ewokra

    (@ewokra)

    Forgive me, but would that be in the style.css? Because I cannot locate it? Or would I find it elsewhere?

    Thanks a ton so far.

    And yes that will be the only sticky post ever.

    Yes, it is your style.css, you will find it in your theme root directory:

    https://www.ewokreacharound.com/wp-content/themes/melville/style.css

    Add a style rule such as:

    #content div#post-28 {
        /* Add style for your sticky post only */
    }

    or

    #content div.sticky {
        /* Add style for your sticky post only */
    }

    Either should work Ok. Let me know how you get on.

    Thread Starter ewokra

    (@ewokra)

    ok I am just trying to find those lines in the .css now. Will let you know how it works shortly

    Thread Starter ewokra

    (@ewokra)

    oh wait, your saying I need to add those lines of code? Sorry I am very rusty on .css hah

    Thread Starter ewokra

    (@ewokra)

    hrm ok so I figured that out, but it seems that only deals with the spacing OUTSIDE the post.

    How can I make the white space inside the actual post itself become smaller. Chiefly the space above “Daily Musings”. I just don’t like all the white space used up by a box that will only ever host quotes, or image thumbnails.

    Thread Starter ewokra

    (@ewokra)

    hrm so no matter what I do I can’t figure this one out. Also is there anyway to make the sticky NOT a post. Or at least not able to be clicked through and also to remove the date and “leave a comment” link?

    I literally just want to use the sticky to post a daily quote or image thumbs

    Thread Starter ewokra

    (@ewokra)

    hrm not sure why my last comment got deleted from this…

    I have seen there are some 3rd party plugins you can get that do this, but there must be a way to do it in the .css as well.

    I have continued to toy around with it to no avail.

    to influence the spacing within the sticky post, (with the css class .sticky), you can make these new styles:

    the title:
    .sticky h2.entry-title { }

    the content:
    .sticky p { }

    and the date/leave a comment:
    .sticky p.date { }

    you need to add these styles new to style.css;

    try to add smaller margins/padding in these styles

    Thread Starter ewokra

    (@ewokra)

    ok I have added them, how can I get rid of the date/leave a comment all together?

    It seems that even though it’s a sticky, it still pulls from the “post” style.

    how can I get rid of the date/leave a comment all together?

    .sticky p.date { display: none; }

    Thread Starter ewokra

    (@ewokra)

    hah, thank you SO much. Did not know it would be as simple as that.

    You sir/maam, just rocked my world.

    Thread Starter ewokra

    (@ewokra)

    still not loving how far below the title the “Daily Musings” text is.

    I assume that white space has nothing to do with the sticky though and has to do with the title post itself?

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Sticky Posts and Changing Their Spacing…’ is closed to new replies.