Too many "Sticky at top of lists"? Put 'em into a rotation.

The "Sticky at top of lists" option is very useful if you want to highlight a particularly important story or promotion. But what if you (or your client) want to promote three or four important messages? Do you make them all sticky?

Not exactly.

To be effective, stickies should be used in moderation. If you make more than one article sticky, you lose the impact stickies were designed to deliver. Multiple stickies also push your dynamic news (the stuff your readers really came to your site for) further down the page and possibly (heaven forbid) below the fold.

Here's a solution we implemented using the Node Queue module. It allows you to identify any number of articles and display them randomly at the top of your home page.

The Finished Product

Here's the end result:

Click to view.

In classic Burma-Shave style...

Click to view.

Each time the home page loads...

Click to view.

A different story appears at the top of the page....

Click to view.

And (thanks to the Drupal magic) the client thinks you're a genius.

The Recipe

Here are the steps we used to pull it off.

Granted, it's not rocket surgery, but maybe it'll help someone trying to achieve the same effect. (Or help me remember what I did the next time I'm asked to add a handful of stickies to a home page.)

  1. Install the Node Queue module.
  2. Add a queue on the Node Queue administration page (/admin/content/nodequeue). I called mine, "Current Promotions".
  3. Make sure you give users who should have rights to add nodes to queues, rights to add nodes to queues.
  4. Nodes of the specified type should now have a "Node queue" tab that allows you to add the node to a queue.
    Before you go further, you might want to snap a screen capture of your block management page(s). When I added a new region to my theme (using the next step) all of my existing blocks disappeared and I had to remember where they had dropped off so I could place them back on the page.
  5. Create a new region on your pages by adding this code to the template.php file in your theme directory:
    <?php
    function bluemarine_regions() {
      return array(
           'left' => t('left sidebar'),
           'right' => t('right sidebar'),
           'content_top' => t('content top'),
           'content_bottom' => t('content bottom'),
           'header' => t('header'),
           'footer' => t('footer')
      );
    }
    
  6. Then add this code to the appropriate place in your page.tpl.php file. I added mine after the "print $messages" statement and before the "print $content" statement.
    <?php print $content_top ?>
    
  7. Create a new block (I called mine current_promotions), be sure to select the php filter and enter this code (qid is the ID number of the queue you created earlier):
    <?php print nodequeue_fetch_random($qid = 1, $teasers = true, $links = true) ?>
    
  8. At the bottom of the block configuration page, set "Page specific visibility settings" to "Show only on the listed pages." and add this code to the list of pages:
    <front>
    
  9. Reconfigure blocks as needed.
  10. Since you'll be pulling a headline and teaser into a "block", you may not be happy with the default formatting. Some CSS tweaking may be in order.

Comments

"Nodes of the specified

"Nodes of the specified type should now have a "Node queue" tab that allows you to add the node to a queue.
Before you go further, you might want to snap a screen capture of your block management page(s). When I added a new region to my theme (using the next step) all of my existing blocks disappeared and I had to remember where they had dropped off so I could place them back on the page."

The tab doesn't show up for me

Simple and

Simple and effective!

Thanks!