Class AdminPageFramework_FieldType_posttype
A post type field can list available post types on the site.
This class defines the posttype field type. By default, the
revision
, attachment
, and nav_menu_item
post type are not displayed.
Field Definition Arguments
Field Type Specific Arguments
- slugs_to_remove - (optional, array) the post type slugs not
to be listed. e.g.
array( 'revision', 'attachment', 'nav_menu_item' )
- select_all_button - [3.3.0+] (optional, array) pass
true
to enable theSelect All
button. To set a custom label, set the text such as__( 'Check All', 'test-domain' )
. Default:true
. - select_none_button - [3.3.0+] (optional, array) pass
true
to enable theSelect None
button. To set a custom label, set the text such as__( 'Check All', 'test-domain' )
. Default:true
. - query - [3.2.1+] (optional, array) an query argument array
to perform custom query to search post types. For the argument specification,
see the
arg
parameter of [get_post_types()](http://codex.wordpress.org/Function_Reference/get_post_types#Parameters) function.public
- Boolean. If true, only public post types will be returned.publicly_queryable
- Booleanexclude_from_search
- Booleanshow_ui
- Booleancapability_type
hierarchical
menu_position
menu_icon
permalink_epmask
rewrite
query_var
_builtin
- Boolean. If true, will return WordPress default post types. Use false to return only custom post types.
- operator - [3.2.1+] (optional, string) An operator to use
with multiple arguments. Either
and
oror
can be used. Default:and
. - save_unchecked - [3.8.8+] (optional, boolean) Whether to
store the values of unchecked items. Default:
true
.
Common Field Definition Arguments
For common field definition arguments, seeAdminPageFramework_Factory_Controller::addSettingField()
.
Example
List All Post Types
array( 'field_id' => 'post_type_checklist', 'title' => __( 'Post Types', 'admin-page-framework-loader' ), 'type' => 'posttype', )
Perform Custom Query
array( 'field_id' => 'post_type_checklist_custom_query', 'title' => __( 'Custom Query', 'admin-page-framework-loader' ), 'type' => 'posttype', 'query' => array( 'public' => true, '_builtin' => false, ), 'select_all_button' => false, 'select_none_button' => false, 'operator' => 'and', 'slugs_to_remove' => array(), )
Package: AdminPageFramework\Common\Form\FieldType
Since: 2.1.5
Image: http://admin-page-framework.michaeluno.jp/image/common/form/field_type/posttype.png
Located at factory/_common/form/field_type/posttype/AdminPageFramework_FieldType_posttype.php
Since: 2.1.5
Image: http://admin-page-framework.michaeluno.jp/image/common/form/field_type/posttype.png
Located at factory/_common/form/field_type/posttype/AdminPageFramework_FieldType_posttype.php
Methods summary
Magic methods summary
Properties summary
public
array
|
$aFieldTypeSlugs |
#
Defines the field type slugs used for this field type. |
protected
array
|
$aDefaultKeys |
#
Defines the default key-values of this field type. Remark
$_aDefaultKeys holds shared default key-values defined in the base class.
|
protected
array
|
$aDefaultRemovingPostTypeSlugs |