I have create a custom post type and then displaying custom post data but when I click on read more button of that custom post it's giving me an error page not foundwhen I click on read more button it's pointing url like this domain.com/abc/my-custom-post here abc is custom post slug. I am sharing you what I did till now.
Custom Post Type
<?php
function create_posttype() {
register_post_type( 'abc',
array(
'labels' => array(
'name' => __( 'ABC' ),
'singular_name' => __( 'ABC' ),
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'abc'),
)
);
}
add_action( 'init', 'create_posttype' );
?>
Displaying custom post code
<?php
$args = array(
'post_type' => 'abc',
'posts_per_page' => -1
);
$wp_query = new WP_Query($args);
while($wp_query->have_posts()) : $wp_query->the_post();
echo get_field('featured_image');
the_title();
echo get_the_excerpt();
endwhile;
wp_reset_query();
?>
Let me know how to connect with post page when clicking read more button.