PHP code example of voceconnect / voce-post-meta

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


if( ! class_exists( 'Voce_Meta_API' ) ) {
	


add_action('init', function(){
	add_metadata_group( 'demo_meta', 'Page Options', array(
		'capability' => 'edit_posts'
	));
	add_metadata_field( 'demo_meta', 'demo_key', 'Title', 'text', array(
		'description' => 'Descriptive string. Example: <code>Description</code>'
	) );
	add_post_type_support( 'page', 'demo_meta' );
});


array(
	'description' => '', // A short description of the expected value displayed with the field.
	'default_value' => '', // The value to be shown and used when not set.
	
	// Override options
	'capability' => '', // User permission level that must be met to edit the field. Defaults to edit_posts
	'display_callbacks' => array(), // An array of valid callable functions to render the field display.
	'sanitize_callbacks' => array() // An array of callable functions to sanitize the field value on save.
);