PHP code example of codemascot / metabox

1. Go to this page and download the library: Download codemascot/metabox library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codemascot / metabox example snippets


$prefix = 'codemascot_'; // Use any prefix you like to prefix the metabox name or id
$metabox_args = [
    [
        $prefix . '-section-title',
        __( 'Section Title', 'text-domain' ),
        'title',
        ' . '-input',
        __( 'Input Text', 'text-domain' ),
        'input',
        '

new \CodeMascot\MetaBox\MetaBox(
    'section-id', // Section DOM ID
    __( 'Section Name', 'text-domain' ), // Section Name
     'post', // Post Type
     $metabox_args, // Arguments
     'advanced', // Context
     'high' // Priority
);

add_filter(
    'codemascot_metabox_api_data_filter',
    'codemascot_metabox_api_data_filter',
    10,
    2
);

/**
 * @param        $data
 * @param string $field_id
 */
function codemascot_metabox_api_data_filter( $data, $field_id ) {
    // Validate or Sanitize Data Here.
}