最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

how to create my own edit.php admin page code or template for my custom post type

programmeradmin3浏览0评论

Most plugins try to hide the components of the edit.php screen on wp admin and replace it with meta boxes to create the needed layout and fields for the custom post type.

But this means that there is still unnecessary code on that edit.php page not used and increases the page load. Also, Not everything can be done using meta boxes.

Is there is a way where i can create my own edit.php page from scratch for my custom post type? maybe hide the custom post type UI and make a new admin page and use it to insert the custom posts or update it? is this possible on admin pages?

Most plugins try to hide the components of the edit.php screen on wp admin and replace it with meta boxes to create the needed layout and fields for the custom post type.

But this means that there is still unnecessary code on that edit.php page not used and increases the page load. Also, Not everything can be done using meta boxes.

Is there is a way where i can create my own edit.php page from scratch for my custom post type? maybe hide the custom post type UI and make a new admin page and use it to insert the custom posts or update it? is this possible on admin pages?

Share Improve this question asked Aug 3, 2013 at 22:29 alhoseanyalhoseany 1,2013 gold badges15 silver badges23 bronze badges 1
  • You can use a plugin like Advanced Custom Fields wordpress.org/plugins/advanced-custom-fields – Cleber Reizen Commented Mar 9, 2022 at 14:53
Add a comment  | 

1 Answer 1

Reset to default 4

When you register the CPT set show_ui to false. For example:

$args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => false, // <-- here
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => array( 'slug' => 'book' ),
    'capability_type' => 'post',
    'has_archive' => true, 
    'hierarchical' => false,
    'menu_position' => null,
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
); 

You will now have to construct an interface for the CPT just as you'd construct one for a admin plugin page. You are not reconstructing or editing edit.php. Your interface will have a different address as given when you register the admin page.

发布评论

评论列表(0)

  1. 暂无评论