akschoeck
akschoeck

Reputation: 57

WordPress single-{cpt}.php not working

This is the php I have to generate the Custom Post Type:

function custom_post_type() {
    $args = array(
        'label'               => __( 'Products', 'rgo' ),
        'labels'              => $labels,
        'supports'            => array( 'title', 'custom-fields', ),
        'hierarchical'        => false,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 20,
        'can_export'          => true,
        'has_archive'         => false,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'page',
    );
    register_post_type( 'rgo-products', $args );
}
add_action( 'init', 'custom_post_type', 1 );

And then I have a file called single-rgo-products.php to handle the individual single posts, but this file is not being loaded when viewing a CPT single page. I'm not even sure what template is being loaded. I've tried making changes to both the single.php and index.php files to see if changes take, and they do not.

I have tried updating the permalinks by going into settings > permalinks and saving that a couple of times.

Upvotes: 0

Views: 888

Answers (2)

Gazi Md. Yeasin
Gazi Md. Yeasin

Reputation: 43

the name of custom single page is wrong. Name should single+(custom post type)

Upvotes: 1

Gazi Md. Yeasin
Gazi Md. Yeasin

Reputation: 43

Refresh your permalink setting and reload the custom single page. I hope it will work.

Upvotes: 1

Related Questions