I am creating gallery pages for events and csr-events custom post type.
Now it has three types of pages:
I have programatically created pages for the above slugs using wp_insert_post: Example for events gallery:
wp_insert_post( array( 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_author' => 1, 'post_parent' => $page['parent'], 'post_name' => $page['slug'], 'post_title' => $page['title'], 'post_status' => 'publish', 'post_type' => $page['post-type'], 'page_template' => $page['template'], ) );
So the pagenames are gallery,events and csr-events.
I have set gallery as a parent page and events and csr-events as child of gallery.
And then in template-gallery.php I check the
Which gives me gallery or events or csr-events.
And based on this I write a query to get images.
I have created an archive list for the these 3 gallery pages by making some changes in this plugin which returns URL in this format :
- For other archive pages having custom post type it returns : http://www.example.com/events/2015/09
and I made changes in the rewrite rule of the plugin which works for other custom post types but does not work for gallery pages :
$line_separated = implode( '|', $post_types );//works for events/ $newrules['(' . $line_separated . ')/(\d*)/(\d*)$'] = 'index.php?post_type=$matches&m=$matches$matches';
What rewrite rule should I use here for http://www.example.com/gallery/events/2015/08 to work.
I tried this
$newrules['gallery/events/(\d*)/(\d*)$'] = 'index.php?pagename=events&m=$matches$matches';
but it just loads gallery/events and removes the year and month
What rewrite rule can I use to load the events page and persist the url such that I can get year and month in the
Note : gallery is not a custom post type here. It is just a page.