Display a single select drop down box containing existing post-types. Custom post types are also supported.

Option Details & Parameters

Type: select-post-types


Can be placed in: Admin Panels , Admin Tabs , Meta Boxes , Theme Customizer

Parameter Type Description
name string The name of the option, for display purposes only.
id string A unique ID for this option. This ID will be used to get the value for this option.
desc string The description to display together with this option.
default string (Optional) The default post ID for this option. Defaults to 0, nothing selected.
livepreview string (Optional) jQuery code that updates something in your site in the live preview. Only used when the option is placed in a theme customizer section. Refer to Livepreview for more information on this parameter.
public boolean (Optional) If true, all post-types will be shown otherwise private post-types. Defaults to true.
value string (Optional) Values can be builtin(built-in post-types), custom(custom post-types), or all(all post-types) the default value.
slug boolean (Optional) If true, post-types slug name will be shown. Defaults to true.


Creating an option:

$AdminPanelTab->createOption( array(
      'name' => 'Select Post-Type Option',
      'id' => 'my_select_post_types_option',
      'type' => 'select-post-types',
      'desc' => 'Select a post-type',
) );