• I’m setting up a normal blog with a bunch of categories, and one of my categories will be called Feature, for in-depth feature articles. When a feature article is published I would like it to stay at the top of the page, with it’s own unique styling (different background colour, in a unique div), until a new feature article is published.

    Is this possible out of the box or would I need a plug-in? If I use a sticky plug-in I assume I will have to manually unsticky old posts, and I wouldn’t be able to have sticky posts appear inside a different div.

    What to you think?

    Thanks.

Viewing 1 replies (of 1 total)
  • You would need to use a plugin to do this without coding but you could hack up your theme to do it if you know what you’re doing (i.e. some php knowledge is necessary).

    I’m not sure about the sticky plugin re: whether you have to turn off sticky posts manually.

    What I did when I came across this problem was perform ‘the loop’ twice instead of just once. The first time, you check if each post has the ‘featured’ category, and show it with the special formatting if it does. Each time you print out a feature, you also add it’s post id to an array (I called mine $do_not_repeat). The second time you loop trough you do it normally, but add a condition that if the id of the post is in the do_not_repeat array, skip it.

    This solution means that your features stay at the top of the page as long as they would have been on that page but disspear once they fall off the bottom.

    If, instead, you wanted to just show the most recent featured post untill a new one was put up, you could use two queries with their own loops, one for just the featured post (and only one post) and one for everything else (with an argument to NOT include the featured category).

    Wiki article about query_posts() for the second idea: http://codex.wordpress.org/Template_Tags/query_posts

    and the one about the loop: http://codex.wordpress.org/The_Loop

Viewing 1 replies (of 1 total)
  • The topic ‘I would like to know if this is possible…’ is closed to new replies.