Yes it is possible. You’ll have to write a custom rewrite rule for making the domain.com/cpt/metaboxes
url to be accessible. Lets say your cpt is ‘movie’, its single will be accessible as domain.com/movie/slug
. Create a new page named ‘Metaboxes’ (slug should be ‘metaboxes’). Add the following code to functions.php.
<?php
add_action('init', 'add_my_rule');
function add_my_rule()
{
global $wp_rewrite, $wp;
$wp_rewrite->add_rule('^movie/([^/]+)/metaboxes', 'index.php?pagename=metaboxes&movie_slug=$matches[1]', 'top');
$wp->add_query_var('movie_slug');
}
?>
After you add this code, go to Settings > Permalinks
and just hit save (don’t miss this step!). Make sure you have pretty permalinks turned on.
Next step is to access the movie_slug
on this page. Create a template which will show the metaboxes content and assign this template to the Metaboxes
page created above. Add the following code to this template:
<?php
/*
* Template Name: Metaboxes
*/
//this will give you the cpt slug.
$slug = get_query_var('movie_slug');
//now we get the cpt object using the slug
$args=array(
'name' => $slug,
'post_type' => 'movie',
'post_status' => 'publish',
'showposts' => 1,
'caller_get_posts'=> 1
);
$movie = get_posts($args);
//we need only the ID
$movie_id = $movie[0]->ID;
//Use the $movie_id to get all the metaboxes content, means the post meta/custom values and build your markup around it.
?>
I haven’t tried this, but I’m sure it will work with a minor tweaks. Let me know if you are stuck or face any errors.