I'm trying to find out the PHP code that will get the current URL and add a hash ID onto the end of it so a link can be generated and linked to.
The end goal is to create a link that returns: http://mydomain.com/news#postID-123. This should a) take users to the news page and b) jump to the part of the news page where the post ID of 123 is displayed.
Ideally I need a solution that can handle pagination within Wordpress, this is my code to get the curent page URL that I spotted on another thread but how do I create a new string from it?
<?php
$Path=$_SERVER['REQUEST_URI'];
$URI= get_bloginfo('url').$Path; // get the current web address for my WP site
?>