Spend the past few days working on a frozen version of Seascape, coping with my temporary thumb-less left hand (it grows back: it’s amazing!). Below you can find a simple fix to the missing/bugish get_previous_post in WordPress; this one is used in a http call (read: ajax) that loads the content in the background. More details for the most curious and ambitious in the jQuery files of the projects (you know where). Short and simple: it receives 3 parameters: $post_id, $post_cat, $howmany and returns the content to update the DOM.
The final version should be online in the next couple of days.
* long silence on Capacity due partly to a lot of nice projects – which means a lot of work – check out what’s new: http://electronest.com/portfolio/ and also, yes, DesignMarketo takes a lot of our time…
** inspiration for this bit of code comes mostly from the nice plugin Other Post From Cat.
$query = "
SELECT ID,
post_title,
post_content,
post_date
FROM {$tp}posts, {$tp}terms, {$tp}term_taxonomy, {$tp}term_relationships
WHERE {$tp}posts.ID = {$tp}term_relationships.object_id
AND {$tp}term_relationships.object_id = {$tp}posts.ID
AND {$tp}term_relationships.term_taxonomy_id = {$tp}term_taxonomy.term_taxonomy_id
AND {$tp}terms.term_id = {$tp}term_taxonomy.term_id
AND {$tp}terms.term_id = {$post_cat}
AND {$tp}term_taxonomy.taxonomy = 'category'
AND post_status = 'publish'
AND post_type = 'post'
AND {$tp}posts.ID < {$post_id}
ORDER BY ID DESC, post_date DESC
LIMIT 0,{$howmany}
";