Skip to content

Instantly share code, notes, and snippets.

@matdave
Created July 20, 2016 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matdave/92d6f97bc941595f1e86b1114f18edf8 to your computer and use it in GitHub Desktop.
Save matdave/92d6f97bc941595f1e86b1114f18edf8 to your computer and use it in GitHub Desktop.
AnchorFix
<?php
// Plugin corrects anchored items when base_ref is set to site root
// Run OnWebPagePrerender
$url = $modx->makeUrl($modx->resource->get('id'));
$modx->resource->_output = str_replace(' href="#', ' href="'.$url.'#', $modx->resource->_output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment