2014-10-08 145 views
0

我正在创建一个自定义帖子类型,并且希望操作Create New Post部分的标题字段中的占位符文本。更改Wordpress帖子标题占位符

要求:
- 它只能针对一种特定的帖子类型,而不能针对所有帖子。
- 它不能反映帖子类型的名称,它必须是完全自定义文本。
- 它不必从wordpress管理部分进行编辑,自定义文本可以放在functions.php文件中的函数中。

回答

3

你可以把这个片段到functions.php

function change_default_title($title){ 

$screen = get_current_screen(); 

if ('your_custom_post_type' == $screen->post_type){ 
$title = 'Your custom placeholder text'; 
} 

return $title; 
} 

add_filter('enter_title_here', 'change_default_title'); 

这应该改变Titel的。

发现日期:https://gist.github.com/FStop/3094617