瀏覽代碼

baugruppen, clients

Juan Carlos 5 年之前
父節點
當前提交
daec5751cf
共有 2 個文件被更改,包括 126 次插入8 次删除
  1. 124 5
      functions.php
  2. 2 3
      index.php

+ 124 - 5
functions.php

@@ -344,17 +344,111 @@ function projekte() {
 }
 
 
+
+add_action('init', 'baugruppen', 0);
+function baugruppen() {
+   $labels = array(
+      'name' => _x('Baugruppen', 'Post Type General Name', 'theme'),
+      'singular_name' => _x('Baugruppe', 'Post Type Singular Name', 'theme'),
+      'menu_name' => __('Baugruppen', 'theme'),
+      'name_admin_bar' => __('Baugruppen', 'theme'),
+      'parent_item_colon' => __('Parent Baugruppen:', 'theme'),
+      'all_items' => __('All Baugruppen', 'theme'),
+      'add_new_item' => __('Add New group', 'theme'),
+      'add_new' => __('Add New', 'theme'),
+      'new_item' => __('New group', 'theme'),
+      'edit_item' => __('Edit group', 'theme'),
+      'update_item' => __('Update group', 'theme'),
+      'view_item' => __('View groups', 'theme'),
+      'search_items' => __('Search groups', 'theme'),
+      'not_found' => __('Not found', 'theme'),
+      'not_found_in_trash' => __('Not found in Trash', 'theme'),
+   );
+
+   $args = array(
+      'label' => __('baugruppen', '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-store',
+   );
+   register_post_type( 'baugruppen', $args );
+}
+
+
+
+add_action('init', 'clients', 0);
+function clients() {
+   $labels = array(
+      'name' => _x('Clients', 'Post Type General Name', 'theme'),
+      'singular_name' => _x('Client', 'Post Type Singular Name', 'theme'),
+      'menu_name' => __('Clients', 'theme'),
+      'name_admin_bar' => __('Clients', 'theme'),
+      'parent_item_colon' => __('Parent Clients:', 'theme'),
+      'all_items' => __('All Clients', 'theme'),
+      'add_new_item' => __('Add New client', 'theme'),
+      'add_new' => __('Add New', 'theme'),
+      'new_item' => __('New client', 'theme'),
+      'edit_item' => __('Edit client', 'theme'),
+      'update_item' => __('Update client', 'theme'),
+      'view_item' => __('View clients', 'theme'),
+      'search_items' => __('Search clients', 'theme'),
+      'not_found' => __('Not found', 'theme'),
+      'not_found_in_trash' => __('Not found in Trash', 'theme'),
+   );
+
+   $args = array(
+      'label' => __('clients', '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-store',
+   );
+   register_post_type( 'clients', $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");
+  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");
+  add_meta_box("projekt-beschreibung",  "Description", "projekt_beschreibung", "projekte", "normal", "low");
+  add_meta_box("projekt-link",          "Link", "projekt_link", "projekte", "normal", "low");
+  // Baugruppen
+  add_meta_box("baugruppe-link",        "Link", "baugruppe_link", "baugruppen", "normal", "low");
+  // Baugruppen
+  add_meta_box("client-link",        "Link", "client_link", "clients", "normal", "low");
 }
 
+
 function mitarbeiter_email(){
   global $post;
   $custom = get_post_custom($post->ID);
@@ -395,6 +489,26 @@ function projekt_link(){
   <?php
 }
 
+function baugruppe_link(){
+  global $post;
+  $custom = get_post_custom($post->ID);
+  $baugruppe_link = $custom["baugruppe_link"][0];
+  ?>
+  <label>Link:</label>
+  <input name="baugruppe_link" value="<?php echo $baugruppe_link; ?>" />
+  <?php
+}
+
+
+function client_link(){
+  global $post;
+  $custom = get_post_custom($post->ID);
+  $client_link = $custom["client_link"][0];
+  ?>
+  <label>Link:</label>
+  <input name="client_link" value="<?php echo $client_link; ?>" />
+  <?php
+}
 
 add_action('save_post', 'save_details');
 
@@ -406,15 +520,20 @@ function save_details(){
   // Projekte
   update_post_meta($post->ID, "projekt_beschreibung", $_POST["projekt_beschreibung"]);
   update_post_meta($post->ID, "projekt_link", $_POST["projekt_link"]);
+  // baugruppen
+  update_post_meta($post->ID, "baugruppe_link", $_POST["baugruppe_link"]);
+  // clients
+  update_post_meta($post->ID, "client_link", $_POST["client_link"]);
 }
 
 
 add_image_size( 'projekt_thumb', 355, 236, true);
 
 /*
-Projekte
+
 Baugrupen
 Kunden
+Testimonials
 */
 
 

+ 2 - 3
index.php

@@ -91,7 +91,7 @@
               <div class="col-lg-4 col-md-6 col-xs-12 mix marketing planning">
                 <div class="portfolio-item">
                   <div class="portfolio-img">
-                 <img src="<?php echo get_the_post_thumbnail_url($posts->post->ID); ?>" alt="<?php the_title(); ?>">
+                    <img src="<?php echo get_the_post_thumbnail_url($posts->post->ID, 'projekt_thumb'); ?>" alt="<?php the_title(); ?>">
                   </div>
                   <div class="portfoli-content">
                     <div class="sup-desc-wrap">
@@ -151,8 +151,7 @@
               $counter = 1;
 
               while ($posts -> have_posts()) {
-                  $posts->the_post();
-              ?>
+                  $posts->the_post(); ?>
                   <!-- Team Item Starts -->
                   <div class="col-lg-3 col-md-6 col-xs-12">
                   <figure>