1
0
mirror of https://github.com/ascribe/wp-theme synced 2024-12-22 09:13:38 +01:00

create testimonials subtemplate & markup

This commit is contained in:
Matthias Kretschmann 2016-03-07 20:46:07 +01:00
parent 5b42f1dfed
commit 52fa08049b

View File

@ -104,6 +104,9 @@ class Subtemplate {
case 'events': case 'events':
$result .= $this->eventPage($subtemplateTitle); $result .= $this->eventPage($subtemplateTitle);
break; break;
case 'testimonials':
$result .= $this->testimonials($subtemplateTitle);
break;
} }
} }
} }
@ -1174,4 +1177,52 @@ class Subtemplate {
return $result; 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 .= "<div class='grid__col'>
<figure class='testimonial'>
<blockquote class='testimonial__quote'>{$quote}</blockquote>
<figcaption class='testimonial__caption'>
<img class='testimonial__avatar' src='{$photo}'>
<cite class='testimonial__cite'>
<span class='testimonial__name'>{$name}</span>
<span class='testimonial__org'><a href='{$link}'>{$company}</a></span>
</cite>
</figcaption>
</figure>
</div>";
}
}
$result = "<section class='subtemplate row'>
<h1 class='subtemplate__title'>{$subtemplateTitle}</h1>
<article class='testimonials grid grid--full grid-medium--fit grid--gutters'>
{$testimonialMarkup}
</article>
</section>";
return $result;
}
} }