[wp-hackers] Handling the featured tags

Mike Little wordpress at zed1.com
Mon Jun 11 12:50:22 UTC 2012


On Mon, Jun 11, 2012 at 1:19 PM, Haluk Karamete <halukkaramete at gmail.com>wrote:

> Would an algorithm like this work?
>
> At save/update post time,
>     check the post's featured category status; by comparing its
> before and after status
>     if the before and after statuses ( as far as featured cat goes )
> are the same, do nothing special.
>     if the before status was unchecked, and the after status is
> checked, then update a field ( WELL WHAT FIELD ? )
>
>    How about post_date_gmt? Right from the wp_posts? What say you?
>
>
If you want to use a standard category (there is no need to, but it might
be more comfortable for your users), then simply hook into the
'added_term_relationship' and 'deleted_term_relationship' actions, and add
or remove a meta data field with a current timestamp. Then, in the function
called from your theme template to retrieve these featured posts, simply
add a reverse sort using the added timestamp meta data.


By the way, this line:

"checked, then update a field ( WELL WHAT FIELD ? )"

comes across as quite rude. Using all capitals is considered the textual
equivalent of 'shouting', and in a forum where you are asking for help,
it's not a good idea to shout at the people you hope will help you.

Mike
-- 
Mike Little
http://zed1.com/


More information about the wp-hackers mailing list