Skip to content

Commit

Permalink
Fixed issue with Genre tax not showing up. Added more custom post types.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispian committed Oct 4, 2019
1 parent 84d0bcd commit 1e1765a
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Content/ContentRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class ContentRegistrar extends service {

protected $post_types = [
PostType\Stories::class,
PostType\Characters::class,
PostType\Places::class,
];

protected $taxonomies = [
Expand Down
50 changes: 50 additions & 0 deletions src/Content/PostType/Characters.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* Short Description Goes Here
*
* @author Chrispian H. Burks <[email protected]>
* @package ChrispianHBurks\WorldBuilder\Content
* @since 2019-10-04
*/

namespace ChrispianHBurks\WorldBuilder\Content\PostType;

use WebDevStudios\OopsWP\Structure\Content\PostType;

class Characters extends PostType {

protected $slug = 'characters';

protected function get_args(): array {
return [
'public' => true,
'supports' => [ 'title', 'editor', 'revisions', 'excerpt', 'thumbnail' ],
'show_ui' => true,
// 'show_in_rest' => true, // Why dos this break showing the taxonomy on the page?
'exclude_from_search' => false,
'delete_with_user' => true,
'taxonomies' => array( 'genre' ),
'capability_type' => 'post',
];
}

protected function get_labels(): array {
return [
'name' => _x( 'Characters', 'post type general name', 'wp-world-builder' ),
'singular_name' => _x( 'Character', 'post type singular name', 'wp-world-builder' ),
'menu_name' => _x( 'Characters', 'admin menu', 'wp-world-builder' ),
'name_admin_bar' => _x( 'Characters', 'add new on admin bar', 'wp-world-builder' ),
'add_new' => _x( 'Add New', 'void update', 'wp-world-builder' ),
'add_new_item' => __( 'Add New Character', 'wp-world-builder' ),
'new_item' => __( 'New Character', 'wp-world-builder' ),
'edit_item' => __( 'Edit Character', 'wp-world-builder' ),
'view_item' => __( 'View Character', 'wp-world-builder' ),
'all_items' => __( 'All Characters', 'wp-world-builder' ),
'search_items' => __( 'Search Characters', 'wp-world-builder' ),
'parent_item_colon' => __( 'Parent Characters:', 'wp-world-builder' ),
'not_found' => __( 'No stories found.', 'wp-world-builder' ),
'not_found_in_trash' => __( 'No stories found in Trash.', 'wp-world-builder' ),
];
}

}
50 changes: 50 additions & 0 deletions src/Content/PostType/Places.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
/**
* Short Description Goes Here
*
* @author Chrispian H. Burks <[email protected]>
* @package ChrispianHBurks\WorldBuilder\Content
* @since 2019-10-04
*/

namespace ChrispianHBurks\WorldBuilder\Content\PostType;

use WebDevStudios\OopsWP\Structure\Content\PostType;

class Places extends PostType {

protected $slug = 'places';

protected function get_args(): array {
return [
'public' => true,
'supports' => [ 'title', 'editor', 'revisions', 'excerpt', 'thumbnail' ],
'show_ui' => true,
// 'show_in_rest' => true, // Why dos this break showing the taxonomy on the page?
'exclude_from_search' => false,
'delete_with_user' => true,
'taxonomies' => array( 'genre' ),
'capability_type' => 'post',
];
}

protected function get_labels(): array {
return [
'name' => _x( 'Places', 'post type general name', 'wp-world-builder' ),
'singular_name' => _x( 'Place', 'post type singular name', 'wp-world-builder' ),
'menu_name' => _x( 'Places', 'admin menu', 'wp-world-builder' ),
'name_admin_bar' => _x( 'Places', 'add new on admin bar', 'wp-world-builder' ),
'add_new' => _x( 'Add New', 'void update', 'wp-world-builder' ),
'add_new_item' => __( 'Add New Place', 'wp-world-builder' ),
'new_item' => __( 'New Place', 'wp-world-builder' ),
'edit_item' => __( 'Edit Place', 'wp-world-builder' ),
'view_item' => __( 'View Place', 'wp-world-builder' ),
'all_items' => __( 'All Places', 'wp-world-builder' ),
'search_items' => __( 'Search Places', 'wp-world-builder' ),
'parent_item_colon' => __( 'Parent Places:', 'wp-world-builder' ),
'not_found' => __( 'No place found.', 'wp-world-builder' ),
'not_found_in_trash' => __( 'No place found in Trash.', 'wp-world-builder' ),
];
}

}
4 changes: 2 additions & 2 deletions src/Content/PostType/Stories.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class Stories extends PostType {
protected function get_args(): array {
return [
'public' => true,
'supports' => [ 'title', 'editor', 'revisions', 'excerpt', 'thumbnail', 'custom-fields', 'taxonomies' ],
'supports' => [ 'title', 'editor', 'revisions', 'excerpt', 'thumbnail' ],
'show_ui' => true,
'show_in_rest' => true,
// 'show_in_rest' => true, // Why dos this break showing the taxonomy on the page?
'exclude_from_search' => false,
'delete_with_user' => true,
'taxonomies' => array( 'genre' ),
Expand Down

0 comments on commit 1e1765a

Please sign in to comment.