删除预览按钮的步骤
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\' );
移除段塞
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 );
资料来源:
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/如果我正确理解了你的问题,这是你的答案。
single-typename.php
archive-typename.php
例如,您有一个自定义的post类型定义为book。一本书。php应该是您正在寻找的。