I wish to write a custom next/prev function to dynamically display publish information inside a fancybox pop-up. So I have to use PHP to obtain the next and former Publish ID according to whatever Publish is presently showing. I understand exactly what the current publish ID is and that i can send that to some function ok, however i can't learn how to use that ID to get the adjacent IDs.

Edit:Here's my code to date (which isn't working)

<?php
require_once("../../../wp-blog-header.php");

if (isset($_POST['data'])){
    $post_id = $_POST['data'];
}else{
    $post_id = "";
}
$wp_query->is_single = true;
$this_post = get_post($post_id);
$in_same_cat = false;
$excluded_categories = '';
$previous = false;
$next_post = get_adjacent_post($in_same_cat,$excluded_categories,$previous);


$post_id = $next_post->id;
$title = $next_post->post_title;

$dataset = array ( "postid"=>$post_id, "posttitle"=>$title );

//Because we want to use json, we have to place things in an array and encode it for json.
//This will give us a nice javascript object on the front side.

echo json_encode($dataset);


?>

get_adjacent_post() uses the worldwide $post since it's reference, so you will want to replace this:

$this_post = get_post($post_id);

with this particular:

global $post;
$post = get_post($post_id);

WordPress offers get_next_post() and get_previous_post(), that can be used here rather than using get_adjacent_post() wonderful individuals arguments. Here's the ultimate product:

<?php
require_once("../../../wp-blog-header.php");

if (isset($_POST['data'])){
    $post_id = $_POST['data'];
}else{
    $post_id = "";
}
$wp_query->is_single = true;

global $post;
$post = get_post($post_id);

$previous_post = get_previous_post();
$next_post = get_next_post();

$post_id = $next_post->id;
$title = $next_post->post_title;

$dataset = array ( "postid"=>$post_id, "posttitle"=>$title );

//Because we want to use json, we have to place things in an array and encode it for json.
//This will give us a nice javascript object on the front side.

echo json_encode($dataset);

?>

I am unsure what secrets you want to use for that IDs and game titles from the previous and then posts within the $dataset array, so I'll leave that out of the box for the time being.