PHP code example of flexpress / component-post-type
1. Go to this page and download the library: Download flexpress/component-post-type 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/ */
flexpress / component-post-type example snippets
$pimple["documentPostType"] = function () {
return new Document();
};
$pimple['PostTypeHelper'] = function ($c) {
return new PostTypeHelper($c['objectStorage'], array(
$c["documentPostType"]
));
};
class Document extends AbstractPostType {
public function getSingularName()
{
return "Doc";
}
public function getPluralName()
{
return "Docs";
}
public function getArgs()
{
$args = parent::getArgs();
$args['supports'] = array("title", "editor");
return $args;
}
protected function getLabels()
{
$labels = parent::getLabels();
$labels['menu_name'] = 'Docs';
return $labels;
}
public function getName()
{
return "document";
}
}