瀏覽代碼

added projekte

Juan Carlos 5 年之前
父節點
當前提交
e36b8fce9d
共有 3 個文件被更改,包括 125 次插入43 次删除
  1. 1 1
      css/main.css
  2. 77 2
      functions.php
  3. 47 40
      index.php

+ 1 - 1
css/main.css

@@ -1867,10 +1867,10 @@ nav#menu span.fa.fa-bars:hover {
   margin-top: 10px;
 }
 
-/* team members tow */
 .team-members-tow figure {
   position: relative;
   cursor: pointer;
+  margin-bottom: 30px;
 }
 
 .team-members-tow figure:hover .image-overlay {

+ 77 - 2
functions.php

@@ -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
+*/
 
 
 

+ 47 - 40
index.php

@@ -235,46 +235,53 @@
 
 
 
-							<div class="row">
-
-							<?php
-
-								$args = array(
-										'post_type' => 'mitarbeiter',
-										'post_status' => 'publish',
-										'posts_per_page' => 10
-								);
-								$posts = new WP_Query( $args );
-								$counter = 0;
-
-								while ( $posts -> have_posts() ) {
-									$posts->the_post();
-
-									// echo	get_the_title(  $posts->post->ID  );
-									// the_content();
-
-									?>
-									
-										<!-- Team Item Starts -->
-										<div class="col-lg-3 col-md-6 col-xs-12">
-	                  <figure>
-	                    <img src="<?php echo get_template_directory_uri(); ?>/img/team/team-05.jpg" alt="">
-	                    <div class="image-overlay">
-	                      <div class="overlay-text text-center">
-	                        <div class="info-text">
-	                          <strong><?php the_title();  ?></strong>
-	                          <span><?php echo get_post_meta(  $posts->post->ID, 'mitarbeiter_position', true );  ?></span>
-	                        </div>
-	                        <hr class="small-divider border-white">
-	                        <ul class="social-icons">
-	                          <li><a href="mailto:<?php echo get_post_meta(  $posts->post->ID, 'mitarbeiter_email', true ); ?>"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
-	                          <li><a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
-	                          <li><a href="#"><i class="fa fa-instagram" aria-hidden="true"></i></a></li>
-	                        </ul>
-	                      </div>
-	                    </div>
-	                  </figure>
-										</div>
+            <div class="row">
+
+            <?php
+
+              $args = array(
+                  'post_type' => 'mitarbeiter',
+                  'post_status' => 'publish',
+                  'posts_per_page' => 10
+              );
+              $posts = new WP_Query( $args );
+              $counter = 1;
+
+              while ( $posts -> have_posts() ) {
+                $posts->the_post();
+
+                // echo	get_the_title(  $posts->post->ID  );
+                // the_content();
+
+                ?>
+
+                  <!-- Team Item Starts -->
+                  <div class="col-lg-3 col-md-6 col-xs-12">
+                  <figure>
+
+                  <?php if get_the_post_thumbnail_url( $posts->post->ID ): ?>
+                  <img src="<?php echo get_the_post_thumbnail_url( $posts->post->ID, array( "width" => 255, "height" => 255 ) ); ?>" alt="<?php the_title();  ?>">
+                  <?php else:  ?>
+                  <img src="<?php echo get_template_directory_uri(); ?>/img/team/team-05.jpg" alt="">
+                  <?php endif  ?>
+                    <div class="image-overlay">
+                      <div class="overlay-text text-center">
+                        <div class="info-text">
+                          <strong><?php the_title();  ?></strong>
+                          <span><?php echo get_post_meta(  $posts->post->ID, 'mitarbeiter_position', true );  ?></span>
+                        </div>
+                        <hr class="small-divider border-white">
+                        <ul class="social-icons">
+                        <li><a href="mailto:<?php echo get_post_meta(  $posts->post->ID, 'mitarbeiter_email', true ); ?>"><i class="" aria-hidden="true"></i>
+                        <?php echo get_post_meta(  $posts->post->ID, 'mitarbeiter_email', true ); ?>
+                        </a></li>
+                         <!-- <li><a href="mailto:<?php echo get_post_meta(  $posts->post->ID, 'mitarbeiter_email', true ); ?>"><i class="fa fa-facebook" aria-hidden="true"></i></a></li>
+                          <li><a href="#"><i class="fa fa-twitter" aria-hidden="true"></i></a></li>
+                          <li><a href="#"><i class="fa fa-instagram" aria-hidden="true"></i></a></li> -->
+                        </ul>
+                      </div>
+                    </div>
+                  </figure>
 	                  <!-- Team Item Ends -->
 
 								<?php