From 52fa08049b064af7f5eefb25ae8b8b3f70eea310 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 7 Mar 2016 20:46:07 +0100 Subject: [PATCH] create testimonials subtemplate & markup --- controller/classes/Subtemplate.php | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/controller/classes/Subtemplate.php b/controller/classes/Subtemplate.php index 6750db7..bd9027d 100644 --- a/controller/classes/Subtemplate.php +++ b/controller/classes/Subtemplate.php @@ -104,6 +104,9 @@ class Subtemplate { case 'events': $result .= $this->eventPage($subtemplateTitle); break; + case 'testimonials': + $result .= $this->testimonials($subtemplateTitle); + break; } } } @@ -1174,4 +1177,52 @@ class Subtemplate { return $result; } + + // + // Subtemplate: Testimonials + // + public function testimonials($subtemplateTitle) { + + $args = array( + 'post_type' => 'testimonial', + 'order' => 'ASC' + ); + + $testimonials = get_posts($args); + $testimonialMarkup = ''; + + if (!empty($testimonials)) { + foreach ($testimonials as $testimonial) { + + $id = $testimonial->ID; + $quote = get_field('quote', $id); + $name = get_field('name', $id); + $company = get_field('company', $id); + $link = get_field('link', $id); + $photo = get_field('photo', $id); + + $testimonialMarkup .= "
+
+
{$quote}
+
+ + + {$name} + {$company} + +
+
+
"; + } + } + + $result = "
+

{$subtemplateTitle}

+
+ {$testimonialMarkup} +
+
"; + + return $result; + } }