Skip to content
This repository was archived by the owner on Mar 27, 2021. It is now read-only.

Custom post types

Gabriel Lacerda edited this page Aug 3, 2017 · 7 revisions

Working with custom post types

To add a custom post_type to setRobot, you need to create a file in the post_types / folder, such as cpt-cars.php and the file will automatically be included.

Note: Remember to use cpt-post-type-name

setRobot uses the class PostTypes to facilitate the creation of CPT's.

Post Type example

<?php

use PostTypes\PostType;

$example = new PostType(array(
	'name' => '',
	'singular' => '',
	'plural' => '',
	'slug' => ''
), array('supports' => array('title'), 'taxonomies'  => array( 'category' )), array(
	'archives'              => '',
	'attributes'            => '',
	'parent_item_colon'     => '',
	'all_items'             => '',
	'add_new_item'          => '',
	'add_new'               => '',
	'new_item'              => '',
	'edit_item'             => '',
	'update_item'           => '',
	'view_item'             => '',
	'view_items'            => '',
	'search_items'          => '',
	'not_found'             => '',
	'not_found_in_trash'    => '',
	'featured_image'        => '',
	'set_featured_image'    => '',
	'remove_featured_image' => '',
	'use_featured_image'    => '',
	'insert_into_item'      => '',
	'uploaded_to_this_item' => '',
	'items_list'            => '',
	'items_list_navigation' => '',
	'filter_items_list'     => '',
));

$example->flush();

Remember to popular this post type with the details of your post type, on the contrary will not appear anything on the dashboard 😆

Clone this wiki locally