Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there any way to define a post.php for a Custom Content Type?

I am trying to remove the Permalink, the Slug and the Preview Changes Button from the edit/creation page of an item in my custom content type.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

To remove Preview Button

function posttype_admin_css() {
    global $post_type;
    $post_types = array(
                        /* set post types */
                        'post_type_name'
                  );
    if(in_array($post_type, $post_types))
    echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
}
add_action( 'admin_head-post-new.php', 'posttype_admin_css' );
add_action( 'admin_head-post.php', 'posttype_admin_css' );

To remove slug

function vipx_remove_cpt_slug( $post_link, $post, $leavename ) {

    if ( 'post_type_name' != $post->post_type || 'publish' != $post->post_status ) {
        return $post_link;
    }

    $post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );

    return $post_link;
}
add_filter( 'post_type_link', 'vipx_remove_cpt_slug', 10, 3 );

Source: http://vip.wordpress.com/documentation/remove-the-slug-from-your-custom-post-type-permalinks/ http://wpsnipp.com/index.php/functions-php/hide-post-view-and-post-preview-admin-buttons/


If I understood your question correctly, here is your answer.

single-typename.php
archive-typename.php

For example, you've a custom post type defined as book. single-book.php should be you're looking for.

share|improve this answer
    
The question seems to be about admin editor rather than front end template. –  Rarst Mar 16 at 14:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.