I am developing a Wordpress theme that uses a lot of AJAX. It is composed of two main pages: the index, which displays a list of posts, and a viewer (similar to single.php).
When a post is clicked in index.php, Wordpress takes the user to viewer.php, which displays the post.
In viewer.php the selected post is displayed, and the links prev an next will load the previous or next posts with AJAX, instead of the current one.
My problem is that in index.php, different category filters can be applied, so I would want the exact sequence of posts displayed in index.php passed to viewer.php, so the next and post will use the sequence of posts that was displayed in the homepage.
I've been reading the docs to understand how WP handles the $wp_query info, but I am not sure I understand it, so I would appreciate your help.