Skip to content

Instantly share code, notes, and snippets.

Created October 25, 2012 21:17
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 anonymous/3955474 to your computer and use it in GitHub Desktop.
Save anonymous/3955474 to your computer and use it in GitHub Desktop.
WP Events Manager grandchild pages
/* /classes/em-permalinks.php starting at line 197 */
$child_posts = get_posts(array('post_type'=>'page', 'post_parent'=>$events_page->ID, 'numberposts'=>0));
foreach($child_posts as $child_post){
$em_rules[$events_slug.$child_post->post_name.'/?$'] = 'index.php?page_id='.$child_post->ID; //single event booking form with slug
/* [new stuff] */
//check if child page has children
$grandchildren = get_pages('child_of='.$child_post->ID);
if( count( $grandchildren ) != 0 ) {
foreach($grandchildren as $grandchild) {
$em_rules[$events_slug.$child_post->post_name.'/'.$grandchild->post_name.'/?$'] = 'index.php?page_id='.$grandchild->ID;
}
}
/* [/new stuff] */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment