multicheck-categories(sample)

Display a set of check boxes for all existing categories. Multiple boxes can be checked. Taxonomies are also supported.

Option Details & Parameters

Type: muticheck-categories

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 array (Optional) An array containing checked term / category IDs.
orderby string (Optional) The sorting field used to display the options in the select box. Value can be any category orderby value in the codex. Defaults to name
order string (Optional) The sorting order used to display the options in the select box. Value can either be asc or desc. Defaults to asc
taxonomy string (Optional) The type of taxonomy / category to show in the select box. Defaults to category.
hide_empty boolean (Optional) If true, categories or taxonomies that do not have posts will not be shown. Defaults to false.
show_count boolean (Optional) If true, the number of posts in each category will be shown. Defaults to false.
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_option' );
var_dump( $value );
// returns
array(2) {
[0]=>
string(1) "2"
[1]=>
string(1) "3"
}

Examples

Creating an option:

$panel->createOption( array(
'name' => 'My Post Categories',
'id' => 'my_multicheck_option',
'type' => 'multicheck-categories',
'desc' => 'Check a category',
) );

Creating a custom taxonomy multicheck option:

$panel->createOption( array(
'name' => 'My Post Categories',
'id' => 'my_multicheck_option',
'type' => 'multicheck-categories',
'desc' => 'Check a category',
'taxonomy' => 'portfolio_category',
) );