Title: Hack / Tutorial: Dynamic Sticky or adhesive
Last modified: August 18, 2016

---

# Hack / Tutorial: Dynamic Sticky or adhesive

 *  [clarke1866](https://wordpress.org/support/users/clarke1866/)
 * (@clarke1866)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/)
 * Greetings all,
 * Thanks to the help of everyone here at these forums I have gotten a large part
   of my site customization done. Recently, I was reading about using multiple loops
   to do various things. Reading up, and asking the right questions (and most importantly,
   getting the right answers from this community) have led me to write a tutorial
   on how I created my own version of a sticky or adhesive post — one that stays
   at the top of the index page.
 * Essentially, it queries the DB twice: first looking for 1 post (the most recent)
   in the ‘featured’ category; and secondly, all posts except the post ‘featured’.
   This allows the featured post to be put into multiple categories just like any
   other post could be, yet treats it as special until a new ‘feature’ post is published.
 * Anyway, head on over to my site, [MaxPower](http://www.maxpower.ca) and see [this post](http://www.maxpower.ca/wordpress-hack-creating-a-dynamic-sticky/2005/04/23/)
   for a full explanation and demonstration. I would appreciate any comments or 
   feature suggestions.

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [Root](https://wordpress.org/support/users/root/)
 * (@root)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-192559)
 * That is very very useful. But I wonder if I might be permitted one small observation.
   For a first time user with no php experience at all the ideal would be a copy
   and paste solution. The codex is full of // do stuff; which is fine but then 
   the guy asks what stuff. This can never be made too easy. But thanks for a great
   piece of work.
 *  [kristin](https://wordpress.org/support/users/kristin/)
 * (@kristin)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-192967)
 * could you maybe post a example from your index.php? for those of us who don’t
   know the codex that well it’s a little confusing.
 *  Thread Starter [clarke1866](https://wordpress.org/support/users/clarke1866/)
 * (@clarke1866)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-192968)
 * I would love too, but I am hesitant at this point because I have discovered that
   by having two or more loops, some plugins will stop working. I don’t understand
   why just yet… the plugins do work, its just they only work on the very first 
   loop. For me, this means that the keyword, meta, and technorati plugins don’t
   funtion as I’d like them too.
 * I have [posted this question](http://wordpress.org/support/topic/32553) to brains
   here, so hopefully someone will give up an answer.
 *  [kristin](https://wordpress.org/support/users/kristin/)
 * (@kristin)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-192969)
 * Sounds good. I stuck it in my template the way you have it on your site, but 
   I kept getting some php errors so I figured I was missing something. Maybe it
   was just a conflict with a plugin that I’m using too.
 *  [kristin](https://wordpress.org/support/users/kristin/)
 * (@kristin)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-192970)
 * I dont think thats the problem I’m having. Ive tried removing every plugin that
   runs in the loop and also deactivated every plugin 1 by 1 to see if it made a
   difference.
 * I get an error : Parse error: parse error, unexpected $ in /home/wiphey/public_html/
   wp-content/themes/wiphey/index.php on line 77
 * Here is the index.php for my template:
    [http://www.wiphey.com/wp-content/themes/wiphey/index.txt](http://www.wiphey.com/wp-content/themes/wiphey/index.txt)
 * If you have any ideas, let me know =)
 *  [kristin](https://wordpress.org/support/users/kristin/)
 * (@kristin)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-192971)
 * I should add that line 77 is the get_footer(); line and theres nothing being 
   called in the footer except for: bloginfo(‘name’); and bloginfo(‘comments_rss2_url’);
 *  [jinsan](https://wordpress.org/support/users/jinsan/)
 * (@jinsan)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-192972)
 * excellent stuff, very intriguing read – I may use something like this in the 
   future, but probably not now. Certainly something to keep in mind, and thanks
   for the breakdown
 *  Thread Starter [clarke1866](https://wordpress.org/support/users/clarke1866/)
 * (@clarke1866)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-192974)
 * I just wrote this up, maybe it helps you out (I haven’t looked yet, but will).
   [Creating a dynamic sticky in Kubrick](http://www.maxpower.ca/wordpress-hack-sticky-adhesive-kubrick/2005/05/03/)
 *  Thread Starter [clarke1866](https://wordpress.org/support/users/clarke1866/)
 * (@clarke1866)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-192975)
 * I think you have something called twice, change this:
 * Before:
    ` $my_query = new WP_Query('category_name=daily&showposts=1'); while(
   $my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->
   ID; ?> php if (have_posts()) : while (have_posts()) : the_post();
 * After:
    ` $my_query = new WP_Query('category_name=daily&showposts=1'); while (
   $my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->
   ID; `
 * Note that I got rid of ?php in order to post the code changes, I don’t know how
   to post code as text yet, its a friggin mystery to me. The point is get rid of
   this first instance of “`php if (have_posts()) : while (have_posts()) : the_post();`”
 *  [kristin](https://wordpress.org/support/users/kristin/)
 * (@kristin)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-192976)
 * yay! that worked. thanks alot 😛
 *  [laxidasical](https://wordpress.org/support/users/laxidasical/)
 * (@laxidasical)
 * [19 years, 6 months ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-193176)
 * This hack broke my sidebar and put it under my main content! Any answers why?
   [http://www.hinkleytalon.com](http://www.hinkleytalon.com)

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Hack / Tutorial: Dynamic Sticky or adhesive’ is closed to new replies.

## Tags

 * [tutorial](https://wordpress.org/support/topic-tag/tutorial/)

 * 11 replies
 * 5 participants
 * Last reply from: [laxidasical](https://wordpress.org/support/users/laxidasical/)
 * Last activity: [19 years, 6 months ago](https://wordpress.org/support/topic/hack-tutorial-dynamic-sticky-or-adhesive/#post-193176)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
