PHP code example of voceconnect / voce-post-meta-media

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

    

voceconnect / voce-post-meta-media example snippets


if( ! class_exists( 'Voce_Post_Meta_Media' ) ) {
	


add_action('init', function(){
	add_metadata_group( 'demo_meta', 'Page Options', array(
		'capability' => 'edit_posts'
	));
	add_metadata_field( 'demo_meta', 'demo_media', 'Demo Media', 'media' );
	add_post_type_support( 'page', 'demo_meta' );
});


add_action('init', function(){
	add_metadata_group( 'demo_meta', 'Page Options', array(
		'capability' => 'edit_posts'
	));
	add_metadata_field( 'demo_meta', 'demo_media', 'Demo Media', 'media', array(
		'mime_types' => array( 'application/pdf' )
	));
	add_post_type_support( 'page', 'demo_meta' );
});