1
0
Moritz Schmidt 9 роки тому
батько
коміт
ae2bff967f
7 змінених файлів з 150 додано та 80 видалено
  1. 1 1
      dist/wp_bootstrap_navwalker.php
  2. 23 57
      functions.php
  3. 79 19
      index.php
  4. 1 1
      page-blog.php
  5. 0 1
      page.php
  6. 28 0
      single-projects.php
  7. 18 1
      style.css

+ 1 - 1
dist/wp_bootstrap_navwalker.php

@@ -99,7 +99,7 @@ class wp_bootstrap_navwalker extends Walker_Nav_Menu {
 			$atts['class'] = "nav-link scroll-link"; // MY EDIT
 			$atts['data-target'] = ltrim($atts['href'], '/');
 			$atts['href'] = ltrim($atts['href'], '/');
-			if(!is_front_page()) {
+			if(!is_front_page() && (strpos($atts['href'], 'http') !== 0)) {
 				$atts['href'] = "/index.php" . $atts['href'];
 			}
 

+ 23 - 57
functions.php

@@ -67,6 +67,20 @@ function create_post_types() {
       'supports' => array('title', 'editor', 'thumbnail'),
     )
   );
+
+  register_post_type( 'projects',
+    array(
+      'labels' => array(
+        'name' => __( 'Projekte' ),
+        'singular_name' => __( 'Projekt' )
+      ),
+      'public' => true,
+      'has_archive' => true,
+      'menu_icon' => 'dashicons-calendar-alt',
+      'supports' => array('title', 'editor', 'thumbnail'),
+      'rewrite' => array('slug' => 'projekte'),
+    )
+  );
 }
 
 /** POST META BOX **/
@@ -101,6 +115,9 @@ function ams_post_box( $object, $box ) { ?>
     <br />
     <label for="ams_partners">Partner</label>
     <input type="checkbox" name="ams_partners" id="ams_partners" style="float: right;" <?php if(get_post_meta($object->ID, 'ams_partners', true)) { echo "checked"; } ?> />
+    <br />
+    <label for="ams_projects">Projekte</label>
+    <input type="checkbox" name="ams_projects" id="ams_projects" style="float: right;" <?php if(get_post_meta($object->ID, 'ams_projects', true)) { echo "checked"; } ?> />
   </p><?php
 }
 
@@ -109,6 +126,7 @@ function ams_post_box_save( $post_id, $post ) {
     "ams_dual_columns_post",
     "ams_tda_gallery",
     "ams_partners",
+    "ams_projects"
   );
 
   if(!isset( $_POST['ams_post_box_nonce']) || !wp_verify_nonce($_POST['ams_post_box_nonce'], basename(__FILE__))) {
@@ -130,62 +148,6 @@ function ams_post_box_save( $post_id, $post ) {
   }
 }
 
-/** TDAS META BOX **/
-
-/* TODO: REMOVE
-add_action( 'load-post.php', 'ams_tdas_box_setup' );
-add_action( 'load-post-new.php', 'ams_tdas_box_setup' );
-
-function ams_tdas_box_setup() {
-  add_action( 'add_meta_boxes', 'ams_tdas_box_add' );
-  add_action( 'save_post', 'ams_tdas_box_save', 10, 2 );
-}
-
-function ams_tdas_box_add() {
-  add_meta_box(
-    'ams_tdas_box',      // Unique ID
-    esc_html__( 'Slider ID'),    // Title
-    'ams_tdas_box',   // Callback function
-    'tdas',         // Admin page (or post type)
-    'side',         // Context
-    'default'         // Priority
-  );
-}
-
-function ams_tdas_box( $object, $box ) { ?>
-  <?php wp_nonce_field( basename( __FILE__ ), 'ams_tdas_box_nonce' ); ?>
-  <p>
-    <label for="ams_tda_sliderid">SliderID</label>
-    <input type="text" name="ams_tda_sliderid" id="ams_tda_sliderid" value="<?php if(get_post_meta($object->ID, 'ams_tda_sliderid', true)) { echo get_post_meta($object->ID, 'ams_tda_sliderid', true); } ?>" />
-  </p><?php
-}
-
-function ams_tdas_box_save( $post_id, $post ) {
-  $inputs = array(
-    "ams_tda_sliderid",
-  );
-
-  if(!isset( $_POST['ams_tdas_box_nonce']) || !wp_verify_nonce($_POST['ams_tdas_box_nonce'], basename(__FILE__))) {
-    return $post_id;
-  }
-
-  $post_type = get_post_type_object( $post->post_type );
-
-  if(!current_user_can($post_type->cap->edit_post, $post_id)) {
-    return $post_id;
-  }
-
-  foreach($inputs as $input) {
-    if((isset($_POST[$input]) && !empty($_POST[$input])) && !get_post_meta($post_id, $input, true)) {
-      add_post_meta($post_id, $input, $_POST[$input]);
-    } else if((isset($_POST[$input]) && !empty($_POST[$input])) && get_post_meta($post_id, $input, true)) {
-      update_post_meta($post_id, $input, $_POST[$input]);
-    } else if((!isset($_POST[$input]) || empty($_POST[$input])) && get_post_meta($post_id, $input, true)) {
-      delete_post_meta($post_id, $input);
-    }
-  }
-}
-*/
 /** TdA Slider **/
 
 global $tdaSlider; // TODO: remove this
@@ -273,7 +235,11 @@ function ams_modify_titles($title, $id = null) {
     return "Tag der Architektur" . preg_replace("/&#?[a-z0-9]{2,8};/i", "", $title) . " &raquo; " . get_bloginfo("name");
   }
 
-  return $title . get_bloginfo("name");
+  if(is_front_page()) {
+    return get_bloginfo("name");
+  }
+
+  return ltrim(preg_replace("/&#?[a-z0-9]{2,8};/i","", $title)) . " &raquo; " . get_bloginfo("name");
 }
 add_filter( 'wp_title', 'ams_modify_titles', 10, 2 );
 

+ 79 - 19
index.php

@@ -16,7 +16,7 @@
         while($query->have_posts()) {
           $query->the_post();
 
-          if(get_post_meta(get_the_ID(), 'ams_dual_columns_post', true) && !get_post_meta(get_the_ID(), 'ams_tda_gallery', true)) { // 2 Spalten
+          if(get_post_meta(get_the_ID(), 'ams_dual_columns_post', true) && !get_post_meta(get_the_ID(), 'ams_tda_gallery', true) && !get_post_meta(get_the_ID(), 'ams_projects', true)) { // 2 Spalten
 
             $more = 1; // get whole content
             $content = get_the_content('', true);
@@ -26,6 +26,9 @@
             $columnTwo = substr($content, strpos($content, '<!--column-->'), strlen($content)); ?>
 
             <div id="post-<?php the_ID(); ?>" class="content-wrapper">
+              <div class="relcontainer">
+                <div id="post-<?php the_ID(); ?>-jumper" class="jumper"></div>
+              </div>
               <div class="beam">
                 <div class="container">
                   <div class="row">
@@ -65,6 +68,9 @@
             $columnTwo = substr($content, strpos($content, '<!--column-->'), strlen($content)); ?>
 
             <div id="post-<?php the_ID(); ?>" class="content-wrapper">
+              <div class="relcontainer">
+                <div id="post-<?php the_ID(); ?>-jumper" class="jumper"></div>
+              </div>
               <div class="beam">
                 <div class="container">
                   <div class="row">
@@ -86,7 +92,7 @@
                   // images (gallery)
                   $tdaQuery = new WP_Query(array('post_type' => 'tdas'));
                   if($tdaQuery->have_posts()) { ?>
-                    <div class="col-md-12 tda-gallery claerfix">
+                    <div class="col-md-12 tda-gallery clearfix">
                       <div class="row"><?php
                         while($tdaQuery->have_posts()) {
                           $tdaQuery->the_post(); ?>
@@ -105,21 +111,7 @@
                         } ?>
                       </div>
                     </div><?php
-                  }
-
-                  /*// content-containers
-                  $tdaQuery = new WP_Query(array('post_type' => 'tdas'));
-                  $count = 0;
-                  if($tdaQuery->have_posts()) {
-                    while($tdaQuery->have_posts()) {
-                      $tdaQuery->the_post(); ?>
-                      <div id="tda-content-<?= $count; ?>" class="col-md-4 tda-content" style="text-align: center; display: none;">
-                        <h1><a href="<?= get_permalink(); ?>"><?php the_title(); ?></a></h1>
-                        <p><?= substr(get_the_excerpt(), 0, strpos(get_the_excerpt(), ' ', 225)) . " ..."; ?></p>
-                      </div><?php
-                      $count++;
-                    }
-                  }*/ ?>
+                  } ?>
                 </div>
               </div>
               <div class="container b-to-top">
@@ -138,6 +130,9 @@
             $partnerQuery = new WP_Query( array( 'post_type' => 'partners', 'orderby' => 'title', 'order' => 'ASC' ) );
             if($partnerQuery->have_posts()) { ?>
               <div id="post-<?php the_ID(); ?>" class="content-wrapper">
+                <div class="relcontainer">
+                  <div id="post-<?php the_ID(); ?>-jumper" class="jumper"></div>
+                </div>
                 <div class="beam">
                   <div class="container">
                     <div class="row">
@@ -175,13 +170,78 @@
               </div><?php
               wp_reset_postdata();
             }
+          } else if(get_post_meta(get_the_ID(), 'ams_dual_columns_post', true) && get_post_meta(get_the_ID(), 'ams_projects', true)) { // 2 Spalten & Projekte
+
+            $more = 1; // get whole content
+            $content = get_the_content('', true);
+            $more = 0; // reset to excerpt only
+
+            $columnOne = substr($content, 0, strpos($content, '<!--column-->'));
+            $columnTwo = substr($content, strpos($content, '<!--column-->'), strlen($content)); ?>
+
+            <div id="post-<?php the_ID(); ?>" class="content-wrapper">
+              <div class="relcontainer">
+                <div id="post-<?php the_ID(); ?>-jumper" class="jumper"></div>
+              </div>
+              <div class="beam">
+                <div class="container">
+                  <div class="row">
+                    <div class="col-md-12">
+                      <h1><?php the_title(); ?></h1>
+                    </div>
+                  </div>
+                </div>
+              </div>
+              <div class="container text-muted">
+                <div class="row">
+                  <div class="col-md-6">
+                    <span class="teaser"><?php the_excerpt(); ?></span>
+                    <?= $columnOne; ?><br>
+                  </div>
+                  <div class="col-md-6">
+                    <?= $columnTwo; ?>
+                  </div><?php
+                  // images (gallery)
+                  $tdaQuery = new WP_Query(array('post_type' => 'projects'));
+                  if($tdaQuery->have_posts()) { ?>
+                    <div class="col-md-12 tda-gallery clearfix">
+                      <div class="row"><?php
+                        while($tdaQuery->have_posts()) {
+                          $tdaQuery->the_post(); ?>
+                          <div class="col-md-3 col-xs-6 tda-item" style="padding-bottom: 15px;">
+                            <div class="relcontainer">
+                              <a href="<?= get_permalink(); ?>">
+                                <?php if(has_post_thumbnail()) the_post_thumbnail('thumbnail', array('class' => 'tda-gallery-item')); ?>
+                                <div class="tda-hover">
+                                  <div class="relcontainer">
+                                    <span><?php the_title(); ?></span>
+                                  </div>
+                                </div>
+                              </a>
+                            </div>
+                          </div><?php
+                        } ?>
+                      </div>
+                    </div><?php
+                  } ?>
+                </div>
+              </div>
+              <div class="container b-to-top">
+                <div class="row">
+                  <div class="col-xs-12">
+                    <a href="#top" class="scroll-link"><i class="fa fa-chevron-up" aria-hidden="true"></i></a>
+                  </div>
+                </div>
+              </div>
+            </div><?php
+
           } else {
             the_title();
             the_excerpt();
           }
         }
       } else {
-        echo "ayy no post lmalala"; // TODO: this
+        echo "404"; // TODO: this
       }
     } else {
       the_title();
@@ -189,4 +249,4 @@
 
     </div><?php
 
-    get_footer(); ?>
+    get_footer(); ?>

+ 1 - 1
page-blog.php

@@ -11,7 +11,7 @@
 get_header();
 
 $cat = get_category_by_slug("Startseite");
-query_posts("cat=-" . $cat->term_id . "&post_type=any");
+query_posts("cat=-" . $cat->term_id . "&post_type=tdas");
 
 if (have_posts()) : while (have_posts()) : the_post(); ?>
   <div id="single" class="content-wrapper">

+ 0 - 1
page.php

@@ -1,5 +1,4 @@
 <?php get_header(); ?>
-
   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
 
     <div id="single" class="content-wrapper">

+ 28 - 0
single-projects.php

@@ -0,0 +1,28 @@
+<?php get_header(); ?>
+  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
+
+    <div id="tdas-single" class="content-wrapper">
+      <div class="beam">
+        <div class="container clearfix">
+          <div class="row">
+            <div class="col-lg-1">
+              <span class="tag tag-pill"><?php the_time("M"); ?><br><div style="margin-top: 5px;"></div><?php the_time("y"); ?></span>
+            </div>
+            <div class="col-lg-11">
+              <h1><?php the_title(); ?></h1>
+            </div>
+          </div>
+        </div>
+      </div>
+      <div class="container text-muted">
+        <div class="row">
+          <div class="col-lg-11 offset-lg-1">
+            <?php the_content(); ?>
+          </div>
+        </div>
+      </div>
+    </div>
+
+  <?php endwhile; endif; ?>
+
+<?php get_footer(); ?>

+ 18 - 1
style.css

@@ -318,6 +318,23 @@ a:hover {
   color: inherit;
 }
 
+.navbar-nav .nav-item:first-child {
+  margin-left: 0;
+}
+
+.card a:hover {
+  color: #014c8c;
+}
+
+#ams-topnav {
+  font-family: 'Special Elite', cursive;
+}
+
+.jumper {
+  position: absolute;
+  top: -50px;
+}
+
 @media(min-width: 544px) {
   .menu-item.dropdown::after {
     content: "\f0d7";
@@ -337,7 +354,7 @@ a:hover {
 }
 
 @media (min-width: 992px) {
-  #tdas-single span.tag {
+  span.tag {
     left: -15px;
     position: absolute;
   }