Class AdminPageFramework_PostType
Provides methods for registering custom post types.
Abstract
Package: AdminPageFramework\Factory\PostType
Since: 2.0.0
Located at factory/post_type/AdminPageFramework_PostType.php
Package: AdminPageFramework\Factory\PostType
Since: 2.0.0
Located at factory/post_type/AdminPageFramework_PostType.php
Methods summary
public
|
#
__construct( string $sPostType, array $aArguments = array(), string $sCallerPath = null, string $sTextDomain = 'admin-page-framework' )
The constructor of the class object. Registers necessary hooks and sets up internal properties. Examplenew APF_PostType( 'apf_posts', // post type slug array( 'labels' => array( 'name' => 'Demo', 'all_items' => __( 'Sample Posts', 'admin-page-framework-demo' ), 'singular_name' => 'Demo', 'add_new' => __( 'Add New', 'admin-page-framework-demo' ), 'add_new_item' => __( 'Add New APF Post', 'admin-page-framework-demo' ), 'edit' => __( 'Edit', 'admin-page-framework-demo' ), 'edit_item' => __( 'Edit APF Post', 'admin-page-framework-demo' ), 'new_item' => __( 'New APF Post', 'admin-page-framework-demo' ), 'view' => __( 'View', 'admin-page-framework-demo' ), 'view_item' => __( 'View APF Post', 'admin-page-framework-demo' ), 'search_items' => __( 'Search APF Post', 'admin-page-framework-demo' ), 'not_found' => __( 'No APF Post found', 'admin-page-framework-demo' ), 'not_found_in_trash' => __( 'No APF Post found in Trash', 'admin-page-framework-demo' ), 'parent' => __( 'Parent APF Post', 'admin-page-framework-demo' ), // (framework specific) 'plugin_action_link' => __( 'APF Posts', 'admin-page-framework-demo' ), // framework specific key. [3.7.3+] ), 'public' => true, 'menu_position' => 110, 'supports' => array( 'title' ), // e.g. array( 'title', 'editor', 'comments', 'thumbnail', 'excerpt' ), 'taxonomies' => array( '' ), 'has_archive' => true, 'show_admin_column' => true, // [3.5+ core] this is for custom taxonomies to automatically add the column in the listing table. 'menu_icon' => $this->oProp->bIsAdmin ? ( version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) ? 'dashicons-wordpress' : plugins_url( 'asset/image/wp-logo_16x16.png', APFDEMO_FILE ) ) : null, // do not call the function in the front-end. // (framework specific) this sets the screen icon for the post type for WordPress v3.7.1 or below. // a file path can be passed instead of a url, plugins_url( 'asset/image/wp-logo_32x32.png', APFDEMO_FILE ) 'screen_icon' => dirname( APFDEMO_FILE ) . '/asset/image/wp-logo_32x32.png', // [3.5.10+] (framework specific) default: true 'show_submenu_add_new' => true, // [3.7.4+] (framework specific) default: 10 'submenu_order_manage' => 20, 'submenu_order_addnew' => 21, ) ); Framework Specific Post Type ArgumentsIn addition to the post type argument structure defined by the WordPress core, there are arguments defined by the framework.
Framework Specific Post Type Label Arguments
To disable the action link, set an empty string Parameters
Since
2.0.0
2.1.6 Added the $sTextDomain parameter. See |