Here’s my situation:
I have a custom post type I created called “professions” with three professions (“military”, “firefighters”, “law-enforcement”).
I created a page single-professions.php
to use as the post page.
I set the slug to “heroes” in my register_post_type
function:
'rewrite' => array( 'slug' => 'heroes', 'with_front' => false )
Here are the full options I set in register_post_type
:
$args = array(
'label' => 'professionals',
'description' => 'Professions of clients served',
'labels' => $labels,
'supports' => array( 'title', 'revisions', 'custom-fields' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'rewrite' => array( 'slug' => 'heroes', 'with_front' => false ),
'menu_position' => 25,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page'
);
My URL structure for each type looks like the following:
/heroes/military/
/heroes/firefighters/
/heroes/law-enforcement/
I also created a page type called “heroes”:
/heroes/
In addition, I created a page called “signup” and set it’s parent to “heroes”:
/heroes/signup/
However, the child page 404’s (the parent page url does not, I think due to has_archive => false
).
Is it possible to have child pages and custom posts share the same parent path?