Add a selected class to a link when criteria is matched