Get a page URL using only the Slug? Wondered what the best approach would be to get the url for a given entry page using only a slug for reference? I imagined it being something like this:

 public function getPageURL($slug) {
    $page = craft()-&gt;elements-&gt;slug($slug);
    @return getURL($page);
  }


Usage example:

&lt;a href="{{ craft.PLUGINNAME.getPageURL("staff") }}"&gt;Staff&lt;/a&gt;
Completely untested, but something like this should work:

public function getPageUrl($slug)
{
    $criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
    $criteria-&gt;slug = $slug;
    $entry = $criteria-&gt;first();

    if ($entry)
    {
        return UrlHelper::getUrl($entry-&gt;uri);
    }
}