Support » Plugins » 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 and see this post for a full explanation and demonstration. I would appreciate any comments or feature suggestions.

Viewing 11 replies - 1 through 11 (of 11 total)
  • 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.

    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.

    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 to brains here, so hopefully someone will give up an answer.

    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.

    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:

    If you have any ideas, let me know =)

    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’);

    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

    I just wrote this up, maybe it helps you out (I haven’t looked yet, but will). Creating a dynamic sticky in Kubrick

    I think you have something called twice, change this:

    $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();

    $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();

    yay! that worked. thanks alot 😛

    This hack broke my sidebar and put it under my main content! Any answers why?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Hack / Tutorial: Dynamic Sticky or adhesive’ is closed to new replies.