post-page

Sticky posts hack for WordPress

18
responses
by
 
on
December 18th, 2003
in
WordPress Hack

I finally had the chance to finish the sticky posts hack for WordPress. Quite simple actually. It lets a blogger indefinitely leave a post on top of their WordPress blog. Here is the link to detailed instructions to install the hack. Let me know if there are any bugs!

heading
heading
18
Responses

 

Comments

  1. Marius Ooms (3 comments.) says:

    I played with the script a little bit for wordpress 1.2 and got it to work after changing one variable. I’m no coder, all I did is clean up the instructions a bit for wordpress 1.2. Here is the link for the instructions, Mark if you approve of these new instructions you can add them your site or do whatever with them.

    Sticky Hack Instructions for WP1.2

    I also clarified how I got the span tag to work for adding a sticky icon as you can see on one of my sections here:

    OOMSonline

    Again, I don’t know code very well, butI can hack and it works for 1.2 now after I had some cross browser issues and such.

    Thanks,
    Marius

    Mark, just edit it as needed, your the creator of this beauty!

  2. Marius Ooms (3 comments.) says:

    I really like this script, but I encountered a big cross-browser issue and I’m a complete newb at any coding other than flash =(

    It works perfect in IE, but in Mozilla it seems to overlay the next post right over top of it.

    http://oomsonline.com

    I run wordpress 1.2

    This is where I put the start and end lines for the loop, maybe that’s where I’m wrong.


    < ?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    < ?php if ($post->post_status == 'sticky') echo '

    '; ?>

    < ?php the_title(); ?>
    _date('','',''); ?> posted < ?php the_time() ?>
    _content(); ?>

    < ?php if ($post->post_status == 'sticky') echo '

    '; ?>

    hp wp_link_pages(); ?>
    < ?php comments_popup_link(__('/ 0 posts so far'), __('/ 1 post, making progress'), __('/ % posts, gotta read this')); ?>
    />

    < ?php include(ABSPATH . 'wp-comments.php'); ?>

    < ?php endforeach; else: ?>

    < ?php endif; ?>

    to this, I would love to know!

    Many Thanks,
    Marius

  3. Marius Ooms (3 comments.) says:

    Sorry, the pasted code got mangeled. You may edit that post, since it make no sense. If you know what I mean though, please let me know.

    Thanks,
    Marius

  4. Timothy B (1 comments.) says:

    Thanks for a great hack! I tried Adhesive but it mussed up my posts. You is da bomb!! =) Astubeft! (Thanks!) =)

  5. TechGnome says:

    Well, no bugs yet….. except that the link doesn’t work…

    TG

  6. Mark (14 comments.) says:

    It should now, I was fixing what I thought was a bug. I also got locked out of my own entry in the WP forums “censored or edited by the admin” Weird!

  7. TechGnome says:

    Yeah…. no sooner did I comment about it being broken then it was fixed. ARGH. Too bad there isn’t a way to edit comments that you leave. Sigh. I think I’m going to give this a try here in a few. Looks straight forward.

    TG

  8. TechGnome says:

    FYI: I got it up and running! Woo-Hoo! That is awesome.

    TG

  9. Mark says:

    :-P Coolness!

  10. Mark says:

    Threaded comment reply

  11. Craig (19 comments.) says:

    Mark,
    Your instructions for implementing this hack are great! I’m going to try installing this today (after backing up files, first! LOL!)

    I’m just wondering something…is there a way I can add some CSS styling to the sticky to make it distinctive? I guess what I’m asking is about the final rendered code on the page–is there a DIV called “sticky” or some such thing that I can pick out to apply CSS? Is this question making any sense?

    Once again, thanks for sharing your talents and your coding with everyone.

    Craig.

  12. Mark (36 comments.) says:

    Let me look into that, I have thought of that as well…

  13. Mark (1 comments.) says:

    Craig,
    You could put something like this inside your inde.php where the b2motor starts(the loop):
    <?php if ($post->post_status == ‘sticky’) echo ‘<span “sticky”>'; ?>

    And put something like this just before b2motor ends (end of loop):
    <?php if ($post->post_status == ‘sticky’) echo ‘<⁄span>'; ?>

    This would wrap the entire sticky post in a div or span or whatever. I have used blockquote id = “sticky” in mine. Check out my blog when you get a chance. I done stole your blockquote css! :-P
    Let me know if it works out well.

  14. jackiefg (2 comments.) says:

    That’s exactly what I had been looking for. Thank you, thank you, thank you. I screwed it up at first (like usual) but after I put back all my old code, I gave it the old college try again and got it working.

  15. muneebk (1 comments.) says:

    Hi Mark,
    Many thanks first of all for writing this hack.

    I implemented your changes, but I am running 1.02, and had problems.

    The post in wordpress worked fine, I created a sticky, and it stuck.

    However when I went to edit any posted page (not even the sticky page) the edit page did not render correctly.

    The footer, with the WordPress link appeared in the excerpt box. Weird? And none of the page showed.

    I checked, and then re-checked my code and could not find a mistake, so I had to rollback the changes.

    Any thoughts on what I should do to fix the edit page?

    Many thanks

    Muneeb.

  16. Shaun Andrews (1 comments.) says:

    You can check out my solution to WP Sticky Posts with an indepth tutorial at http://shaunandrews.com/2006/0.....cky-posts/



Trackbacks/Pingbacks

  1. […] Pictorialis wordpress powered photoblogging And this one was on Weblog Tools Collection: Sticky Post Hack Get a post to stay indefinitely (until you […]

  2. […] t stay on top above “newer” posts – until I indicate otherwise) Previously, I had blogged this link on Weblog Tools Collection – I now notice there i […]

Obviously Powered by WordPress. © 2003-2013

page counter
css.php