PHP code example of mbv-media / magic-meta-box

1. Go to this page and download the library: Download mbv-media/magic-meta-box 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/ */

    

mbv-media / magic-meta-box example snippets


$myMetaBox->addSelectField(
    'my-select', // Select name
    array( // Options
      0 => 'Yes',
      1 => 'No'
    ),
    true, // Multiple
    array( // Additional attributes
        'size' => 5
    ),
    'My select' // Associated label text
);

$meta = get_post_meta( $postId, 'prefix_my-metabox', true );
echo $meta['my-text-field'];