I am using Underscores starter theme and I’ve created a custom post type video
.
$args = array(
'label' => __( 'Video', 'text_domain' ),
'description' => __( 'Videos', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-video-alt2',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
);
register_post_type( 'video', $args );
I am able to display the latest posts from video
on the homepage (which is a custom page template) but when I visit the video link, I get Oops! That page can’t be found!
I’ve created a new file single-video.php
and inside I’m getting the video template
get_template_part( 'template-parts/content', 'video' );
I’ve also created another file content-video.php
which lives inside template-parts
folder and is the copy of the original content.php
file
But it’s not working, I’m still getting Page Not Found
when I visit the video url.
2 Answers
In your dashboard go to settings/permalinks. Hit save. You should be able to see your cpts now.