PHP code example of javaabu / post-types

1. Go to this page and download the library: Download javaabu/post-types 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/ */

    

javaabu / post-types example snippets


use Javaabu\PostTypes\Facades\PostTypes;
use Javaabu\PostTypes\PostType;
use Javaabu\PostTypes\Taxonomy;
use Javaabu\Stencil\Fields\TextInput;

// AppServiceProvider::boot()
PostTypes::taxonomy(Taxonomy::make('categories')->hierarchical());

PostTypes::register(
    PostType::make('news')
        ->labels('News article', 'News')
        ->supports(['content', 'excerpt', 'media', 'meta'])
        ->taxonomies(['categories'])
        ->metaFields([TextInput::make('subtitle')])
        ->permalink('{year}/{month}/{slug}')
);

// routes/web.php
Route::postTypesAdmin(['guard' => 'web_admin', 'prefix' => 'admin', 'name' => 'admin.']);
Route::postTypes();