In my understanding its not possible to mix "posts" and "pages" in WordPress.
That's right, because post aren't hierarchical, but pages are.
When you register your custom post type using register_post_type()
you can set it as hierarchical using the arguments hierarchical
. The default value being false.
If you set 'hierarchical' => true
your custom post type will act like a PAGE, with hierarchical capabilities. If you set 'hierarchical' => false
your custom POST type will act like a post, without hierarchical capabilities.
Once this is done, after setting a custom post type as jobs
with 'hierarchical' => true
and creating a parent page called details
and a child page called application-form
will get you /jobs/details/application-form/
.
add_action( 'init', function() {
$args = [
// ...
'hierarchical' => true,
// ...
];
register_post_type( '_your_custom_post_type_slug_', $args );
} );
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…