Last active
November 5, 2016 09:01
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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