badcrocodile
6/14/2015 - 9:16 PM

Compare permalink to current URL

Compare permalink to current URL

<?php
/* -- Compare the URL to the permalink, return true if matches -- */
function is_current_page($permalink) {
    $url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
    if (strpos($url,$permalink) !== false)
        return true;
    else
        return false;
}
?>