我正在尝试在自定义帖子类型编辑屏幕中包含帖子标题。例如,如果帖子名为传记,我希望编辑页面标题为“编辑传记”。我正在使用以下代码:
function my_post_register() {
$mypagetitle = $post->post_title;
$labels = array(
\'edit_item\' => __(\'Edit \'.$mypagetitle),
为什么不显示帖子标题?我正在尝试在自定义帖子类型编辑屏幕中包含帖子标题。例如,如果帖子名为传记,我希望编辑页面标题为“编辑传记”。我正在使用以下代码:
function my_post_register() {
$mypagetitle = $post->post_title;
$labels = array(
\'edit_item\' => __(\'Edit \'.$mypagetitle),
为什么不显示帖子标题?This will do it:
function edit_screen_title() {
global $post, $title, $action, $current_screen;
if( isset( $current_screen->post_type ) && $current_screen->post_type == \'post\' && $action == \'edit\' )
$title = \'Edit \' . $post->post_title;
}
add_action( \'admin_head\', \'edit_screen_title\' );
我有两个建议。首先尝试在函数中添加全局$post作为第一行
global $post;
另外,在获取post\\u标题时遇到问题的地方,我找到了另一个函数$mypagetitle = single_post_title(\'\', false);
您可以试试-更多详细信息:http://codex.wordpress.org/Function_Reference/single_post_title我的w-admin登录有一个奇怪的问题。这是从我升级到3.0以后才开始的,当我转到wp admin时,登录表单显示正常,但当我输入用户名并通过时,每次都会再次显示登录表单。使用密码恢复功能会导致电子邮件未找到错误。我知道用户名密码和电子邮件是正确的,b/c我可以访问mysql数据库,我可以看到值(至少用户名和电子邮件) 有人知道会出什么问题吗