Skip to content

Instantly share code, notes, and snippets.

@akamola
Last active November 5, 2016 09:01
Show Gist options
  • Save akamola/27ed4bd3919bb723931d to your computer and use it in GitHub Desktop.
Save akamola/27ed4bd3919bb723931d to your computer and use it in GitHub Desktop.
MODX: Snippet to get the ID of the grandparent resource (see: http://goo.gl/prdscX)
<?php
$id = $modx->resource->get('id');
$parents = $modx->getParentIds($id, 2);
$grandparent = $parents[1];
return $grandparent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment