PHP code example of innocode-digital / wpkit

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

    

innocode-digital / wpkit example snippets




$cars_post_type = new WPKit\PostType\PostType('car','Car');

$metabox = new WPKit\PostType\MetaBox('data','Properties');

$cars_post_type->add_metabox( $metabox );

$metabox->add_post_type( $cars_post_type );

$metabox->add_field( 'reg_no', 'Registration #' );  // By default Text field will be used
$metabox->add_field( 'year', 'Year', 'Number' );    // You can set Field in 3rd parameter as string
$metabox->add_field( 'color', 'Color', function(){  // Or use more flexible callback function
	$filed = new WPKit\Fields\Select();
	$filed->set_options([                           // Like settings options and other
		'red',
		'black',
		'white',
		'yellow'
	]);
	
	return $filed;                                  // Function should always return created filed
} );


 $year = WPKit\PostType\MetaBox::get( get_the_ID(), 'data', 'year' ); 



WP_Mock::bootstrap();

define( 'TEMPLATEPATH', __DIR__ );
$loader = new \WPKit\Module\Loader();
$loader->phpunit_load_modules();