mirror of
https://github.com/ascribe/wp-theme
synced 2024-12-22 09:13:38 +01:00
programmatically add all existing Custom Post Types
This commit is contained in:
parent
e99d6ead16
commit
809bfde6d9
@ -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();
|
||||
|
30
includes/cpt-career.php
Normal file
30
includes/cpt-career.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
function ascribe_register_cpt_career() {
|
||||
$labels = array(
|
||||
"name" => "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' );
|
||||
|
||||
?>
|
31
includes/cpt-event.php
Normal file
31
includes/cpt-event.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
function ascribe_register_cpt_event() {
|
||||
$labels = array(
|
||||
"name" => "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' );
|
||||
|
||||
?>
|
30
includes/cpt-presscoverage.php
Normal file
30
includes/cpt-presscoverage.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
function ascribe_register_cpt_press() {
|
||||
$labels = array(
|
||||
"name" => "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' );
|
||||
|
||||
?>
|
29
includes/cpt-team.php
Normal file
29
includes/cpt-team.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
function ascribe_register_cpt_team() {
|
||||
$labels = array(
|
||||
"name" => "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' );
|
||||
|
||||
?>
|
@ -1,3 +0,0 @@
|
||||
# Includes
|
||||
|
||||
All theme classes, objects, and libraries should be hidden away in this `/includes` directory.
|
Loading…
Reference in New Issue
Block a user