groups

name language licence
WORDPRESS GET URL PHP BSD
To detect if a plugin is installed... PHP Other
Styling Images in WordPress PHP Other
Displaying Custom Fields PHP Other
Getting Custom Fields PHP Other

< 1 2 3 4 5 6 7 8 9 10 11 12 >



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...)