I am trying to ajax my wordpress site with the jquery hashchange plugin as seen in Screencast #85. The problem I am running into is that I am unable to target and style the content that has been loaded by ajax because the body ID is not changing when a new page is clicked.
I have tried the following, but they either leave the ID empty, set it to “home” or “default”.
1.
2.
$page = $_SERVER;
$page = str_replace('/', '', $page);
$page = str_replace('.php', '', $page);
$page = str_replace('?s=', '', $page);
$page = $page ? $page : 'default';
?>
3.
$url = explode('/', $_SERVER);
$dir = $url[1] ? $url[1] : 'home';
?>
Is there a function in php or javascript that will set the body ID even if a hash symbol has been added to the current URL?
I am new to this and I am wondering if I am making this too difficult. I may be searching for the wrong solution.
Thanks in advance for any help you can provide!