Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This is all about featuring content in WP.

Say, you got 1000's of posts that you accumulated over the years and each has their own original ( and true ) post dates.

And now you want to feature them again.

Say in your category taxonomy, you have a branch called Featured and underneath are the sub items as follows;

Featured
    Main Headline
    Must See
    Worth A look
    Not to Miss
    etc.

And in your theme, you have a zone to display these various featured posts. As an example, you have a "must see" zone that features the last 10 posts that you did and you happened to categorize it under "must see".

The question is what do we mean here by "the last"? The last according to the post_date, right?

What if I were to feature an article that's from the past? How do I do that? Just selecting the "must see" is not going to help because as I add more and more items to the "must see" category, how do I display them in the order I featured them. One way to tackle this is to change the post_date I guess? But would not that mess up the archival information. I have a hard time justifying changing the original post date just for the sake of featuring things in proper order.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Use Sticky Posts.

In the Post editor find the "Publish" section. Next to "Visibility" click on edit and then check the "Stick this post to the front page" option there. Click save and you're done.

In the loop, you can check if a post is_sticky().

To loop them, you can use the post__in or post_not__in keys for your query with a value of get_option( 'sticky_posts' );.

There are also some Plugins in case you don't want to dig in code.


Other options…

…would be to assign

  • a special category
  • a tag
  • …or a custom field.

Edit:

Combine categories/tags + sticky posts.

Fetch »all get_option( 'sticky_posts' ) with a Tag of "Featured" (or inside Category "Featured"), then: ORDER BY post_last_modified_date LIMIT 10«.

share|improve this answer
    
İf i have 25 sticky posts Monday, and tuesday I add 5 more, then Wednesday I find 3 more, and my theme zone "must-see" has room to show only 10 items, obviously your method is not gonna work. The point is as you feature posts for a specific zone or category, you want those posts to appear in the last in first out fashion. Last featured is to appear as the first seen by the visitors. And you want to do this without unchecking the featured ones and without messing up with the post date. Do you have a solution for that? –  Average Joe Apr 24 '12 at 12:34
    
See updated Answer –  kaiser Apr 24 '12 at 12:40
    
will test and get back to you. thank you kaiser. –  Average Joe Apr 24 '12 at 13:11
    
you mentioned "In the Post editor find the "Publish" section. Next to "Visibility" click on edit and then check the "Stick this post to the front page" option there. Click save and you're done.". What if you have a bunch of category landing pages ( kind of like portal landing pages such as sports cat, science cat and so on ) where each cat page has a home-page like layout of its own. Just imagine that they have their own "must-see" zones. From this regard, I get confused with the part of your statement that said "Stick this post to the front page". Why does it have to be to the FP? –  Average Joe Apr 24 '12 at 13:24
1  
1) Please add all your requirements to your original Q. Else this extends to infinity. 2) This statement is taken from Codex. 3) Combine categories and sticky posts. Just add a Category (as already mentioned) that´s named "featured". Then adjust your queries for those pages to fetch the "sticky posts" inside cat "featured" that matches the name of the currently display cat. –  kaiser Apr 24 '12 at 13:32
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.