From 809bfde6d954eba09303ddeb474df3199e21370c Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 7 Mar 2016 20:10:05 +0100 Subject: [PATCH] programmatically add all existing Custom Post Types --- functions.php | 6 +++++- includes/{functions => }/core.php | 0 includes/cpt-career.php | 30 ++++++++++++++++++++++++++++++ includes/cpt-event.php | 31 +++++++++++++++++++++++++++++++ includes/cpt-presscoverage.php | 30 ++++++++++++++++++++++++++++++ includes/cpt-team.php | 29 +++++++++++++++++++++++++++++ includes/readme.md | 3 --- 7 files changed, 125 insertions(+), 4 deletions(-) rename includes/{functions => }/core.php (100%) create mode 100644 includes/cpt-career.php create mode 100644 includes/cpt-event.php create mode 100644 includes/cpt-presscoverage.php create mode 100644 includes/cpt-team.php delete mode 100644 includes/readme.md diff --git a/functions.php b/functions.php index 9a3cb38..3a9955f 100644 --- a/functions.php +++ b/functions.php @@ -24,7 +24,11 @@ define( 'WPTHEME_PATH', get_template_directory() . '/' ); define( 'WPTHEME_INC', WPTHEME_PATH . 'includes/' ); // Include compartmentalized functions -require_once WPTHEME_INC . 'functions/core.php'; +require_once WPTHEME_INC . 'core.php'; +require_once WPTHEME_INC . 'cpt-team.php'; +require_once WPTHEME_INC . 'cpt-career.php'; +require_once WPTHEME_INC . 'cpt-presscoverage.php'; +require_once WPTHEME_INC . 'cpt-event.php'; // Run the setup functions TenUp\ascribe\Core\setup(); diff --git a/includes/functions/core.php b/includes/core.php similarity index 100% rename from includes/functions/core.php rename to includes/core.php diff --git a/includes/cpt-career.php b/includes/cpt-career.php new file mode 100644 index 0000000..e1dcd13 --- /dev/null +++ b/includes/cpt-career.php @@ -0,0 +1,30 @@ + "Careers", + "singular_name" => "Career", + ); + + $args = array( + "labels" => $labels, + "description" => "", + "public" => true, + "show_ui" => true, + "show_in_rest" => false, + "has_archive" => false, + "show_in_menu" => true, + "exclude_from_search" => false, + "capability_type" => "post", + "map_meta_cap" => true, + "hierarchical" => false, + "rewrite" => array( "slug" => "career", "with_front" => true ), + "query_var" => true, + + ); + register_post_type( "career", $args ); +} + +add_action( 'init', 'ascribe_register_cpt_career' ); + +?> diff --git a/includes/cpt-event.php b/includes/cpt-event.php new file mode 100644 index 0000000..b1b2919 --- /dev/null +++ b/includes/cpt-event.php @@ -0,0 +1,31 @@ + "Events", + "singular_name" => "Event", + ); + + $args = array( + "labels" => $labels, + "description" => "", + "public" => true, + "show_ui" => true, + "show_in_rest" => false, + "has_archive" => false, + "show_in_menu" => true, + "exclude_from_search" => false, + "capability_type" => "post", + "map_meta_cap" => true, + "hierarchical" => false, + "rewrite" => array( "slug" => "event", "with_front" => true ), + "query_var" => true, + + "supports" => array( "title" ), + ); + register_post_type( "event", $args ); +} + +add_action( 'init', 'ascribe_register_cpt_event' ); + +?> diff --git a/includes/cpt-presscoverage.php b/includes/cpt-presscoverage.php new file mode 100644 index 0000000..9ec0bdc --- /dev/null +++ b/includes/cpt-presscoverage.php @@ -0,0 +1,30 @@ + "Press Coverage", + "singular_name" => "Press Coverage", + ); + + $args = array( + "labels" => $labels, + "description" => "", + "public" => true, + "show_ui" => true, + "show_in_rest" => false, + "has_archive" => false, + "show_in_menu" => true, + "exclude_from_search" => false, + "capability_type" => "post", + "map_meta_cap" => true, + "hierarchical" => false, + "rewrite" => array( "slug" => "presscoverage", "with_front" => true ), + "query_var" => true, + + ); + register_post_type( "presscoverage", $args ); +} + +add_action( 'init', 'ascribe_register_cpt_press' ); + +?> diff --git a/includes/cpt-team.php b/includes/cpt-team.php new file mode 100644 index 0000000..e8563a7 --- /dev/null +++ b/includes/cpt-team.php @@ -0,0 +1,29 @@ + "Team Members", + "singular_name" => "Team Member", + ); + + $args = array( + "labels" => $labels, + "description" => "", + "public" => true, + "show_ui" => true, + "show_in_rest" => false, + "has_archive" => false, + "show_in_menu" => true, + "exclude_from_search" => false, + "capability_type" => "post", + "map_meta_cap" => true, + "hierarchical" => false, + "rewrite" => array( "slug" => "team", "with_front" => true ), + "query_var" => true, + ); + register_post_type( "team", $args ); +} + +add_action( 'init', 'ascribe_register_cpt_team' ); + +?> diff --git a/includes/readme.md b/includes/readme.md deleted file mode 100644 index 45d2b3c..0000000 --- a/includes/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# Includes - -All theme classes, objects, and libraries should be hidden away in this `/includes` directory.