You can add this code in functions.php file and it will give you a meta box above the publish settings box when editing a post or page.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <?php function cf_post_id() { global $post; // Get the data $id = $post->ID; // Echo out the field echo '<input type="text" name="_id" value="' . $id . '" class="widefat" disabled />'; } function ve_custom_meta_boxes() { add_meta_box('projects_refid', 'Post ID', 'cf_post_id', 'post', 'side', 'high'); add_meta_box('projects_refid', 'Page ID', 'cf_post_id', 'page', 'side', 'high'); } add_action('add_meta_boxes', 've_custom_meta_boxes'); ?> |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.