Why my “single-events.php“ not working?

i made child theme and i created single-events.php file for my custom post type events but it not working in child theme
can anyone please help what can be problems or i missed something?

my custom post type code

/events custom post type/

if ( !post_type_exists(‘show’) ) {
function register_show_type() {
$label_singular = ‘events’;
$label_plural = ‘events’;
register_post_type(
‘events’,
array(
‘label’ => $label_plural,
‘description’ => ”,

‘public’ => true,
‘show_ui’ => true,
‘show_in_menu’ => true,
‘capability_type’ => ‘post’,
‘hierarchical’ => false,
‘query_var’ => true,
‘has_archive’ => true,
‘rewrite’ => array(
‘slug’ => ‘events’,
‘with_front’ => false,
),
‘supports’ => array(
‘title’,
‘editor’,
‘revisions’,
‘thumbnail’,
‘custom-fields’,
),
‘labels’ => array (
‘name’ => $label_plural,
‘singular_name’ => $label_singular,
‘menu_name’ => $label_plural,
‘add_new’ => ‘Add New’,
‘add_new_item’ => ‘Add New ‘ . $label_singular,
‘edit’ => ‘Edit’,
‘edit_item’ => ‘Edit ‘ . $label_singular,
‘new_item’ => ‘New ‘ . $label_singular,
‘view’ => ‘View ‘ . $label_singular,
‘view_item’ => ‘View ‘ . $label_singular,
‘search_items’ => ‘Search ‘ . $label_plural,
‘not_found’ => ‘No ‘ . $label_plural . ‘ Found’,
‘not_found_in_trash’ => ‘No ‘ . $label_plural . ‘ Found in Trash’,
‘parent’ => ‘Parent ‘ . $label_singular,
)
)
);
}
add_action(‘init’, ‘register_show_type’);
}

/end of events custom post type/

single-events.php code is:

<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
echo ‘<h1>’.get_the_title().'</h1>’;
}
}
?>

Read more here:: Why my “single-events.php“ not working?

Leave a Reply

Your email address will not be published. Required fields are marked *