multicheck-post-types(sample)

Display a set of check boxes for all existing post-types. Multiple boxes can be checked. Custom post types are also supported.

Option Details & Parameters

Type: muticheck-post-types

Returns: array

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.
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.
select_all string/boolean (Optional) Allows the ability to select or deselect all checkboxes from a single checkbox. To define custom caption for selectall checkbox specify a string instead of boolean value true. To disable the selectall checkbox specify the boolean value of false.

Returns

$titan = TitanFramework::getInstance( 'my-theme' );
$value = $titan->getOption( 'my_multicheck_post_types_option' );
var_dump( $value );
// returns
array(2) {
[0]=>
string(4) "post"
[1]=>
string(4) "page"
}

Examples

Creating an option:

$panel->createOption( array(
'name' => 'Multicheck Post-Types',
'id' => 'my_multicheck_post_types_option',
'type' => 'multicheck-post-types',
'desc' => 'Check a post-type',
) );