groups

name language licence
Default Usage PHP Other
grid.css PHP Other
WORDPRESS GET URL PHP BSD
custom CSS Other
page PHP Other
slideshow-static PHP Other
searchform PHP Other
quotes PHP Other

< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 >



language: PHP
licence: BSD

WORDPRESS GET URL

options: view full snippetsend to code collector
//This function gets the exact string that shows in the address bar. If you use it with no arguments, function will simply return the string, if you put TRUE as the argument, the function returns a html link to the current url. This works whether you are on a post or a page. It strips any other query information like searches.

function url_is($showlink = FALSE) {
	if ($_GET['page_id'])
		$query = 'page_id=' . $_GET['page_id'];
	else
		$query = 'p=' . $_GET['p'];
	$urlis = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . '?' . $query;
	if($showlink == TRUE)
		return '<a href="' . $urlis . '">' . $urlis . '</a>';
	else
		return $urlis;
}
	
(Continues...)