I am trying to figure out a way to have a previous and next button to display more data for a given query-sorta like a pagination would do.
The query is this:
$query = "SELECT *
FROM wp_posts p
LEFT OUTER JOIN wp_term_relationships r ON r.object_id = p.ID
LEFT OUTER JOIN wp_term_taxonomy x ON x.term_taxonomy_id = r.term_taxonomy_id
LEFT OUTER JOIN wp_terms t ON t.term_id = x.term_id
LEFT JOIN wp_postmeta pm ON p.id = pm.post_id
WHERE p.post_status = 'publish'
AND pm.meta_key = 'xTraData'
AND p.post_type = 'post'
AND t.slug = 'press-coverage'
ORDER BY p.post_date DESC LIMIT 0,6;";
How can i get the previous id and next id to use for the next/previous buttons for refreshing the query string?