1. Go to this page and download the library: Download devstudio-rs/wpmvc 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/ */
class Event_Options_Controller extends \wpmvc\web\Meta_Box_Controller {
public function on_action( $model ) {
echo View::render( 'views/events/meta-box', array(
'model' => $model,
) );
}
public function on_save( $model ) {
if ( $model->load( App::$app->request->post() ) ) {
$model->save();
}
}
}
class Event_Options_Meta_Box extends \wpmvc\models\Meta_Box_Model {
public $id = 'event_options';
public $controller = Event_Options_Controller::class;
public function init() {
$this->set_title( __( 'Options' ) );
}
}
class Event extends \wpmvc\models\Post_Model {
public $post_type = 'event';
public function init() {
$this->add_meta_box( Event_Options_Meta_Box::class );
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.