I think you want
if ($_SESSION['some_variable'] === '1') {
}
(or if the variable is numeric)
if ($_SESSION['some_variable'] === 1) {
}
unless you're checking to see if *any* session is set, in which case it would be
if (isset($_SESSION)) {
}
For a custom output modifier, I believe the part inside the brackets would be:
return substr($input, 0, strpos($input, '#'));
Assuming that you call the custom output modifier snippet RemoveAnchor, the tag in the Tpl chunk would be something like:
<a href="[[+wf.link:RemoveAnchor]]">