|
|
@@ -254,6 +254,9 @@ add_action('wp_enqueue_scripts', 'bones_fonts');
|
|
|
// ************************************************************ \\
|
|
|
|
|
|
|
|
|
+// https://blog.teamtreehouse.com/create-your-first-wordpress-custom-post-type
|
|
|
+https://developer.wordpress.org/reference/functions/register_post_type/#capability_type
|
|
|
+
|
|
|
add_action('init', 'mitarbeiter', 0);
|
|
|
function mitarbeiter() {
|
|
|
$labels = array(
|
|
|
@@ -297,13 +300,59 @@ function mitarbeiter() {
|
|
|
register_post_type( 'mitarbeiter', $args );
|
|
|
}
|
|
|
|
|
|
+add_action('init', 'projekte', 0);
|
|
|
+function projekte() {
|
|
|
+ $labels = array(
|
|
|
+ 'name' => _x('Projekte', 'Post Type General Name', 'theme'),
|
|
|
+ 'singular_name' => _x('Projek', 'Post Type Singular Name', 'theme'),
|
|
|
+ 'menu_name' => __('Projekte', 'theme'),
|
|
|
+ 'name_admin_bar' => __('Projekte', 'theme'),
|
|
|
+ 'parent_item_colon' => __('Parent Projekte:', 'theme'),
|
|
|
+ 'all_items' => __('All Projekte', 'theme'),
|
|
|
+ 'add_new_item' => __('Add New project', 'theme'),
|
|
|
+ 'add_new' => __('Add New', 'theme'),
|
|
|
+ 'new_item' => __('New project', 'theme'),
|
|
|
+ 'edit_item' => __('Edit project', 'theme'),
|
|
|
+ 'update_item' => __('Update project', 'theme'),
|
|
|
+ 'view_item' => __('View projects', 'theme'),
|
|
|
+ 'search_items' => __('Search projects', 'theme'),
|
|
|
+ 'not_found' => __('Not found', 'theme'),
|
|
|
+ 'not_found_in_trash' => __('Not found in Trash', 'theme'),
|
|
|
+ );
|
|
|
+
|
|
|
+ $args = array(
|
|
|
+ 'label' => __('projekte', 'theme'),
|
|
|
+ 'labels' => $labels,
|
|
|
+ 'description' => __('Team', 'theme'),
|
|
|
+ 'supports' => array('title', 'thumbnail'),
|
|
|
+ //'taxonomies' => array('category', 'post_tag'),
|
|
|
+ 'hierarchical' => false,
|
|
|
+ 'public' => true,
|
|
|
+ 'show_ui' => true,
|
|
|
+ 'show_in_menu' => true,
|
|
|
+ 'menu_position' => 5,
|
|
|
+ 'show_in_admin_bar' => true,
|
|
|
+ 'show_in_nav_menus' => true,
|
|
|
+ 'can_export' => true,
|
|
|
+ 'has_archive' => true,
|
|
|
+ 'exclude_from_search' => false,
|
|
|
+ 'publicly_queryable' => true,
|
|
|
+ 'capability_type' => 'page',
|
|
|
+ 'menu_icon' => 'dashicons-id',
|
|
|
+ );
|
|
|
+ register_post_type( 'projekte', $args );
|
|
|
+}
|
|
|
|
|
|
|
|
|
add_action("admin_init", "admin_init");
|
|
|
|
|
|
function admin_init(){
|
|
|
+ // mitarbetier
|
|
|
add_meta_box("mitarbeiter-position", "Position", "mitarbeiter_position", "mitarbeiter", "normal", "low");
|
|
|
add_meta_box("mitarbeiter-email", "Email", "mitarbeiter_email", "mitarbeiter", "normal", "low");
|
|
|
+ // Projekte
|
|
|
+ add_meta_box("projekt-beschreibung", "Description", "projekt_beschreibung", "projekte", "normal", "low");
|
|
|
+ add_meta_box("projekt-link", "Link", "projekt_link", "projekte", "normal", "low");
|
|
|
}
|
|
|
|
|
|
function mitarbeiter_email(){
|
|
|
@@ -326,18 +375,44 @@ function mitarbeiter_position(){
|
|
|
<?php
|
|
|
}
|
|
|
|
|
|
+function projekt_beschreibung(){
|
|
|
+ global $post;
|
|
|
+ $custom = get_post_custom($post->ID);
|
|
|
+ $projekt_beschreibung = $custom["projekt_beschreibung"][0];
|
|
|
+ ?>
|
|
|
+ <label>Description:</label>
|
|
|
+ <input name="projekt_beschreibung" value="<?php echo $projekt_beschreibung; ?>" />
|
|
|
+ <?php
|
|
|
+}
|
|
|
|
|
|
+function projekt_link(){
|
|
|
+ global $post;
|
|
|
+ $custom = get_post_custom($post->ID);
|
|
|
+ $projekt_link = $custom["projekt_link"][0];
|
|
|
+ ?>
|
|
|
+ <label>Link:</label>
|
|
|
+ <input name="projekt_link" value="<?php echo $projekt_link; ?>" />
|
|
|
+ <?php
|
|
|
+}
|
|
|
|
|
|
-add_action('save_post', 'save_details');
|
|
|
|
|
|
+add_action('save_post', 'save_details');
|
|
|
|
|
|
function save_details(){
|
|
|
global $post;
|
|
|
+ // mitarbeiter
|
|
|
update_post_meta($post->ID, "mitarbeiter_position", $_POST["mitarbeiter_position"]);
|
|
|
update_post_meta($post->ID, "mitarbeiter_email", $_POST["mitarbeiter_email"]);
|
|
|
+ // Projekte
|
|
|
+ update_post_meta($post->ID, "projekt_beschreibung", $_POST["projekt_beschreibung"]);
|
|
|
+ update_post_meta($post->ID, "projekt_link", $_POST["projekt_link"]);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+/*
|
|
|
+Projekte
|
|
|
+Baugrupen
|
|
|
+Kunden
|
|
|
+*/
|
|
|
|
|
|
|
|
|
|