Created
October 25, 2012 21:17
-
-
Save anonymous/3955474 to your computer and use it in GitHub Desktop.
WP Events Manager grandchild pages
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
/* /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