PHP code example of r4c00n / magic-meta-box

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

    

r4c00n / 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'];