vendredi 13 mai 2016

Single post view for custom post type plugin

I have created custom post type "opinion" Plugin. My codes are following:

function create_post_type_opinion() {
register_post_type('opinion', 
    array(
        'labels' => array(
            'name' => __( 'Opinions'),
                    'singular_name' => __( 'Opinion'),
            'add_new' => __('Add New Opinion' ),
            'add_new_item' => __('Add New Opinion'),
            'edit' => __( 'Edit Opinion' ),
                'edit_item' => __( 'Edit Opinion' ),
                'new_item' => __( 'New Opinion' ),
                'view' => __( 'View Opinion' ),
                'view_item' => __( 'View Opinion' ),
                'search_items' => __( 'Search Opinions' ),
                'not_found' => __( 'No Opinions found' ),
                'not_found_in_trash' => __( 'No Opinions found in Trash' )
                    ),
    'public' => true,
    'menu_position' => 5,
    'menu_icon' => plugins_url( 'images/opinion-20x20.png', __FILE__ ),
    'rewrite' => array(
        'slug' => __('opinion')
    ), 
    'supports' => array( 'title','editor', 'excerpt', 'comments', 'revisions', 'thumbnail')));
}
add_action( 'init', 'create_post_type_opinion' );

But am unable to preview my custom post. It's calling content of index.php. I have created single-opinion.php for in my theme folder. Still am not able to preview the content of my "opinion" post type (introduced via custom plugin code above).

Kindly some one help me out to resolve this issue.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire