I'm trying to work out how I can order news posts by postDate, unless a lightswitch is toggled for a post, at which point it will use the dateUpdated to order that item.

This is so a client can still change posts without them appearing at the top of the list (for corrections, etc), but also make substantial updates to certain posts and have them appear as the latest newest item.

This is quite an interesting solution, wondering if we could produce a solution based around this idea. Thank you :)
–
ianistedJul 8 '14 at 13:33

Forgot to say that you just need to add this function to your primary plugin class and sort your entries by postDate.
–
Victor InJul 8 '14 at 13:52

3

If you're going to the trouble of resetting the postDate programatically, why don't you just ask your client to change the postDate themselves—they'd be changing the lightswitch field anyway? This would give you the exact same result but without any extra code.
–
Stuart WhiteheadJul 8 '14 at 14:27