-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demo post type and taxonomy that can be cloned
- Loading branch information
1 parent
a253d52
commit 0b8990d
Showing
2 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
mu-plugins/10up-plugin/includes/classes/PostTypes/Demo.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
/** | ||
* Demo Post Type | ||
* | ||
* @package TenUpPlugin | ||
*/ | ||
|
||
namespace TenUpPlugin\PostTypes; | ||
|
||
/** | ||
* Demo post type. | ||
*/ | ||
class Demo extends AbstractPostType { | ||
|
||
/** | ||
* Get the post type name. | ||
* | ||
* @return string | ||
*/ | ||
public function get_name() { | ||
return 'tenup-demo'; | ||
} | ||
|
||
/** | ||
* Get the singular post type label. | ||
* | ||
* @return string | ||
*/ | ||
public function get_singular_label() { | ||
return esc_html__( 'Demo', 'tenup-plugin' ); | ||
} | ||
|
||
/** | ||
* Get the plural post type label. | ||
* | ||
* @return string | ||
*/ | ||
public function get_plural_label() { | ||
return esc_html__( 'Demos', 'tenup-plugin' ); | ||
} | ||
|
||
/** | ||
* Can the class be registered? | ||
* | ||
* @return bool | ||
*/ | ||
public function can_register() { | ||
return false; | ||
} | ||
|
||
/** | ||
* Returns the default supported taxonomies. The subclass should declare the | ||
* Taxonomies that it supports here if required. | ||
* | ||
* @return array | ||
*/ | ||
public function get_supported_taxonomies() { | ||
return [ | ||
'tenup-tax-demo', | ||
]; | ||
} | ||
|
||
/** | ||
* Run any code after the post type has been registered. | ||
* | ||
* @return void | ||
*/ | ||
public function after_register() { | ||
// Register any hooks/filters you need. | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
mu-plugins/10up-plugin/includes/classes/Taxonomies/Demo.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* Demo Taxonomy | ||
* | ||
* @package TenUpPlugin | ||
*/ | ||
|
||
namespace TenUpPlugin\Taxonomies; | ||
|
||
/** | ||
* Demo Taxonomy. | ||
*/ | ||
class Demo extends AbstractTaxonomy { | ||
|
||
/** | ||
* Get the taxonomy name. | ||
* | ||
* @return string | ||
*/ | ||
public function get_name() { | ||
return 'tenup-tax-demo'; | ||
} | ||
|
||
/** | ||
* Get the singular taxonomy label. | ||
* | ||
* @return string | ||
*/ | ||
public function get_singular_label() { | ||
return esc_html__( 'Demo Term', 'tenup-plugin' ); | ||
} | ||
|
||
/** | ||
* Get the plural taxonomy label. | ||
* | ||
* @return string | ||
*/ | ||
public function get_plural_label() { | ||
return esc_html__( 'Demo Terms', 'tenup-plugin' ); | ||
} | ||
|
||
/** | ||
* Checks whether the Module should run within the current context. | ||
* | ||
* @return bool | ||
*/ | ||
public function can_register() { | ||
return false; | ||
} | ||
} |