multicheck-posts(sample)

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

Option Details & Parameters

Type: muticheck-posts

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 post IDs.
post_type string (Optional) The post_type of the posts to show. Can be used to show custom post types. Defaults to post
num int (Optional) The number of posts to show in the select box. Defaults to -1 (all posts)
post_status string (Optional) The post_status of the post to show in the select box. Value can be any status parameter in the codex. Defaults to any.
orderby string (Optional) The sorting field used to display the options in the select box. Value can be any post orderby value in the codex. Defaults to post_date
order string (Optional) The sorting order used to display the options in the select box. Value can either be asc or desc. Defaults to desc
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 Posts',
'id' => 'my_multicheck_option',
'type' => 'multicheck-posts',
'desc' => 'Check a post',
) );

Creating a multicheck option for a custom post type:

$panel->createOption( array(
'name' => 'My Posts',
'id' => 'my_multicheck_option',
'type' => 'multicheck-posts',
'desc' => 'Check a post',
'post_type' => 'portfolio_post',
) );