How to go about modifying the Wordpress “Pages Add New Screen”

假装没事ソ 提交于 2019-11-28 12:49:29

We add a Custom Meta Box and do our thing inside it.

There are some hooks that are not Meta Boxes and we can use to insert content into that admin page:

add_action( 'edit_form_top', function( $post ) 
{
    echo '<h1 style="color:red">edit_form_top</h1>';
});

add_action( 'edit_form_after_title', function( $post ) 
{
    echo '<h1 style="color:red">edit_form_after_title</h1>';
});

add_action( 'edit_form_after_editor', function( $post ) 
{
    echo '<h1 style="color:red">edit_form_after_editor</h1>';
});

add_action( 'edit_page_form', function( $post ) 
{
    // edit_page_form is ONLY for pages, the other is for the rest of post types
    echo '<h1 style="color:red">edit_page_form/edit_form_advanced</h1>';
});

add_action( 'dbx_post_sidebar', function( $post ) 
{
    echo '<h1 style="color:red">dbx_post_sidebar</h1>';
});

The widget_text block belongs to Advanced Custom Fields (it's a repeatable/sortable field). I'm not sure anymore, but I think it removes the Meta Box borders with CSS or jQuery.

Instead of messing with the core files of wordpress (which would be a really bad idea) I would suggest making a custom field/sidebar or a menu page to use the drag/drop function to make a page or post.

http://codex.wordpress.org/Custom_Fields

http://codex.wordpress.org/Function_Reference/add_menu_page

If you want some examples on how others have done something similar (as a plugin) you could look at the code from others and see if you can use similar techniques to add additional fields within the screen options.

http://simple-fields.com/

http://www.advancedcustomfields.com/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!