You have to specify the type as switch inside the array key called type.
<?php
// text field for normal text
array(
'label' => 'Text Field',
'id' => "_your_id",
'type' => 'switch', // specify the type field
'placeholder' => '',
'default' => '', // do not remove default key
)
?>
Use our function called tpmeta_field(‘_your_id’) and pass the above array id key to fetch the metadata. Since the function tpmeta_field(‘_your_id’) will return the value so you have to echo the value.Â