• Resolved steve-moore

    (@steve-moore)


    What would be the best way to identify a post as sticky so when visitors look at my site they don’t think that I haven’t updated in x amount of time because the last post seems outdated.

    I tried the wp-sticky plugin and tried to use the announcement banner but couldn’t get it to work.

    I found a fix that required some knowledge of css and I don’t have that yet.

    Any suggestions?

    Maybe I didn’t use the wp-sticky plugin correctly?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    WordPress has built in support for sticky posts, you don’t need a plugin.

    As for making it look good, well, you do need to use some CSS. It’s not hard.

    Look in your theme, probably in the index.php file. Make sure you have something that looks similar to this:
    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">

    The important bit there is the “post_class”. That’s what you’re looking for. If that is there, then sticky posts get a special tag on them called, appropriately enough, “sticky”.

    So, edit your style.css file, and add something like this:

    .sticky {
    background-color: yellow;
    }

    Save, and reload the site. See? You can just add any sort of styles you want to it now.

    Not having knowledge of CSS means that this is the perfect time to start learning: https://www.google.com/search?q=css+tutorial

    Thread Starter steve-moore

    (@steve-moore)

    Thanks

    One more question.

    Since I have only made very basic modifications to any of my css files as of yet, I am worried that I will modify something, have it not work, and not be able to get it back to the way that it was.

    Since I would only be modifying one file in this case, what is the best way to make sure I can restore it if it doesn’t work out?

    Copy and paste the original into a text editor and save it?

    Do I have to restore it from a backup?

    I know that is probably simple as well, just a little hesitant.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    It’s pretty difficult to really muck up CSS, but if you’re worried, just make a backup. Make a copy of the file itself, call it backup-style.css or something like that.

    Copying and pasting the whole thing into another file is the same thing. It’s just a text file, after all.

    It’s pretty difficult to really muck up CSS

    Oh – I don’t know about that. ??

    Seriously, I’ve seen some really terrible messes. Usually caused by piling new CSS on top of old CSS ad finitum until it becomes really difficult to entangle which bit affects what element. Over use of positioning is also another really fast route to total chaos.

    Copy and paste the original into a text editor and save it?

    I’d say that’s a really good low-tech backup system. Add dates to the filenames so you can easily distinguish different versions and can roll back to an older stylesheet very quickly.

    Do I have to restore it from a backup?

    For CSS, no. Just grab the newest working stylesheet copy from your text backups, paste the entire file contents over your online stylesheet and you’ll be back in business again. Should take about 30 seconds.

    Thread Starter steve-moore

    (@steve-moore)

    Thanks. I appreciate it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to identify a post as sticky?’ is closed to new replies.