1. Go to this page and download the library: Download micropackage/models 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/ */
micropackage / models example snippets
use Micropackage\Models\PostType;
class TestimonialPostType extends PostType
{
/**
* Define icon, whether post type should be public and other attributes.
* Labels will be generated automatically.
*
* @see https://developer.wordpress.org/reference/functions/register_post_type/
*/
protected static function getArgs(): array
{
return [
'menu_icon' => 'dashicons-cart',
'public' => true,
];
}
}
new TestimonialPostType();
use Micropackage\Models\Taxonomy;
class PlaceTaxonomy extends Taxonomy
{
/**
* Define to which post types taxonomy should belongs.
*
* You can use slug of any post types or classname of post types created
* using this package.
*/
protected static array $objectTypes = [
'product',
TestimonialPostType::class,
];
/**
* Define whether taxonomy should be hierarchical and other attributes.
* Labels will be generated automatically.
*
* @see https://developer.wordpress.org/reference/functions/register_taxonomy/
*/
protected static function getArgs(): array
{
return [
'hierarchical' => true,
];
}
}
new PlaceTaxonomy();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.