PHP code example of palmtree / wp-custom-post-type

1. Go to this page and download the library: Download palmtree/wp-custom-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/ */

    

palmtree / wp-custom-post-type example snippets



use Palmtree\WordPress\CustomPostType\CustomPostType;

$project = new CustomPostType('project');

$callToAction = new CustomPostType([
    'post_type' => 'cta',
    'public' => false,
]);


use Palmtree\WordPress\CustomPostType\CustomPostType;

$project = new CustomPostType([
    'post_type' => 'project',
    'front' => 'my-projects',
    'taxonomies' => [
        [
            'name' => 'Project Tags',
            'hierarchical' => false,
        ],
        [
            'name' => 'Project Categories',
            'singluar_name' => 'Project Category',
        ]
    ],
]);