您可以使用挂钩来完成上述操作。在活动主题中使用以下代码functions.php
获取此工作的文件
删除wordpress帖子标题下的permalink
add_filter( \'get_sample_permalink_html\', \'wpse_125800_sample_permalink\' );
function wpse_125800_sample_permalink( $return ) {
$return = \'\';
return $return;
}
从原始wordpress自定义帖子链接
add_filter( \'page_row_actions\', \'wpse_125800_row_actions\', 10, 2 );
add_filter( \'post_row_actions\', \'wpse_125800_row_actions\', 10, 2 );
function wpse_125800_row_actions( $actions, $post ) {
unset( $actions[\'inline hide-if-no-js\'] );
unset( $actions[\'view\'] );
return $actions;
}
从原始Wordpress自定义发布按钮
下面有改进的空间,我无法让挂钩执行以下操作,所以使用css方法隐藏它。
global $pagenow;
if ( \'post.php\' == $pagenow || \'post-new.php\' == $pagenow ) {
add_action( \'admin_head\', \'wpse_125800_custom_publish_box\' );
function wpse_125800_custom_publish_box() {
if( !is_admin() )
return;
$style = \'\';
$style .= \'<style type="text/css">\';
$style .= \'#edit-slug-box, #minor-publishing-actions, #visibility, .num-revisions, .curtime\';
$style .= \'{display: none; }\';
$style .= \'</style>\';
echo $style;
}
}
NOTES
附加条件语句在我的例子中,这里我已经解决了条件语句
global $pagenow;
if( \'edit.php\' == $pagenow && isset($_GET[\'page_type\']) == \'my-custom-post\' ){
// here i use delete post row function that explained by Maruti Mohanty on my custom post
}
还有用于添加新帖子和自定义发布元数据库设置的条件语句
global $pagenow;
if( \'page-new.php\' == $pagenow && isset($_GET[\'page_type\']) == \'my-custom-post\' ){
// here i use add new post and custom publish metabox function
}
如果有其他解释,请告诉我。
谢谢