I'm using WAMP and the root folder of my page is: http://localhost/projects/bp/
In a Worpress application and I want to give unique id's to the body
tag of every Page. So I did the following:
<?php
$page = $_SERVER['REQUEST_URI'];
$page = str_replace("/","",$page);
$page = str_replace(".php","",$page);
$page = str_replace("?s=","",$page);
$page = $page ? $page : 'default'
?>
<body id="<?php echo $page ?>">
When I clicked the About
page the URL change to the following: http://localhost/projects/bp/about
and $page
showed the following value:projectsbpabout
What can I do so that $page just show the last word of the URL. In this case, about
, I don't want the projectsbp
part)?
Do I have to change something in the Wordpress routing?