ソースを参照

Fixed #5: Weiterleitung auf /tag-der-architektur für Archiv
Hoverbox shortcode hinzugefügt ([hoverboxes type="tdas"] z.B.)

Moritz Schmidt 9 年 前
コミット
c4b2d9f099
3 ファイル変更43 行追加2 行削除
  1. 1 0
      archive-tdas.php
  2. 40 0
      functions.php
  3. 2 2
      index.php

+ 1 - 0
archive-tdas.php

@@ -0,0 +1 @@
+<?php wp_redirect( '/tag-der-architektur', 301 ); exit; ?>

+ 40 - 0
functions.php

@@ -665,6 +665,46 @@ function carousel_shortcode_func($atts) {
 }
 add_shortcode('carousel', 'carousel_shortcode_func');
 
+// Hover Boxes
+
+function hoverboxes_shortcode_func($atts) {
+  $a = shortcode_atts( array(
+      'type' => NULL
+  ), $atts );
+
+  $output = "";
+
+  // images (gallery)
+  $tdaQuery = new WP_Query(array('post_type' => $a['type']));
+  if($tdaQuery->have_posts()) {
+    $output .= "<div class=\"col-md-12 tda-gallery clearfix\">" . PHP_EOL;
+      $output .= "<div class=\"row\">" . PHP_EOL;
+        while($tdaQuery->have_posts()) {
+          $tdaQuery->the_post();
+          $output .= "<div class=\"col-md-3 col-xs-4 tda-item\" style=\"padding-bottom: 15px;\">" . PHP_EOL;
+            $output .= "<div class=\"relcontainer\">" . PHP_EOL;
+              $output .= "<a href=\"" . get_permalink() . "\">" . PHP_EOL;
+                if(has_post_thumbnail()) {
+                  $output .= get_the_post_thumbnail(get_the_ID(), 'thumbnail', array('class' => 'tda-gallery-item')) . PHP_EOL;
+                }
+                $output .= "<div class=\"tda-hover\">" . PHP_EOL;
+                  $output .= "<div class=\"relcontainer\">" . PHP_EOL;
+                    $output .= "<span>" . get_the_title() . "</span>" . PHP_EOL;
+                  $output .= "</div>" . PHP_EOL;
+                $output .= "</div>" . PHP_EOL;
+              $output .= "</a>" . PHP_EOL;
+            $output .= "</div>" . PHP_EOL;
+          $output .= "</div>" . PHP_EOL;
+        }
+      $output .= "</div>" . PHP_EOL;
+    $output .= "</div>" . PHP_EOL;
+  }
+
+  return $output;
+}
+
+add_shortcode('hoverboxes', 'hoverboxes_shortcode_func');
+
 /* TITLE STUFF */
 
 function ams_modify_titles($title, $id = null) {

+ 2 - 2
index.php

@@ -84,10 +84,10 @@
                 <div class="row">
                   <div class="col-md-6">
                     <span class="teaser"><?php the_excerpt(); ?></span>
-                    <?= $columnOne; ?><br>
+                    <?= do_shortcode($columnOne); ?><br>
                   </div>
                   <div class="col-md-6">
-                    <?= $columnTwo; ?>
+                    <?= do_shortcode($columnTwo); ?>
                   </div><?php
                   // images (gallery)
                   $tdaQuery = new WP_Query(array('post_type' => 'tdas'));