id一直是开源程序的优化和特性在wordpress中也不例外,只是在wordpress中id隐藏在链接中挺链接查看id号已经成为wordpress开发者的下意识形为但是对刚刚接触到wordpress的小白这种体现方法不太适用,所以要把id列在后台的明显位置或是列表中这样不旦方便查看而且方便记录,只需要一段代码添加到functions.php函数尾部或是开发功能即可成生。简单实用
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?php add_filter('manage_posts_columns', 'wpjam_id_manage_posts_columns'); add_filter('manage_pages_columns', 'wpjam_id_manage_posts_columns'); function wpjam_id_manage_posts_columns($columns){ $columns['post_id'] = 'ID'; return $columns; } add_action('manage_posts_custom_column','wpjam_id_manage_posts_custom_column',10,2); add_action('manage_pages_custom_column','wpjam_id_manage_posts_custom_column',10,2); function wpjam_id_manage_posts_custom_column($column_name,$id){ if ($column_name == 'post_id') { echo $id; } } ?> |