1
0
mirror of https://github.com/ascribe/wp-theme synced 2024-12-22 17:23:55 +01:00

prevent markup output when regular/featured faq is empty

This commit is contained in:
Matthias Kretschmann 2016-03-12 15:31:35 +01:00
parent 94712bf4de
commit fbd72a9be9

View File

@ -647,9 +647,17 @@ class Subtemplate {
return $result; return $result;
} }
//
// Subtemplate: FAQs
//
public function faq($subtemplateTitle) { public function faq($subtemplateTitle) {
$featuredFAQ = '<dl class="featured-faqs">';
if (have_rows('featured_faqs')) { if (have_rows('featured_faqs')) {
$featuredFAQ = '<dl class="featured-faqs">';
while (have_rows('featured_faqs')) { while (have_rows('featured_faqs')) {
the_row(); the_row();
@ -659,11 +667,14 @@ class Subtemplate {
$featuredFAQ .= "<dt>{$question}</dt> $featuredFAQ .= "<dt>{$question}</dt>
<dd>{$answer}</dd>"; <dd>{$answer}</dd>";
} }
}
$featuredFAQ .= "</dl>"; $featuredFAQ .= "</dl>";
}
if (have_rows('regular_faqs')) {
$regularFAQ = '<dl class="regular-faqs">'; $regularFAQ = '<dl class="regular-faqs">';
if (have_rows('regular_faqs')) {
while (have_rows('regular_faqs')) { while (have_rows('regular_faqs')) {
the_row(); the_row();
@ -673,8 +684,9 @@ class Subtemplate {
$regularFAQ .= "<dt>Q: {$question}</dt> $regularFAQ .= "<dt>Q: {$question}</dt>
<dd>A: {$answer}</dd>"; <dd>A: {$answer}</dd>";
} }
}
$regularFAQ .= "</dl>"; $regularFAQ .= "</dl>";
}
$result = "<section class='subtemplate row row--content content faq'> $result = "<section class='subtemplate row row--content content faq'>
<h1>{$subtemplateTitle}</h1> <h1>{$subtemplateTitle}</h1>
@ -684,6 +696,8 @@ class Subtemplate {
return $result; return $result;
} }
public function values($subtemplateTitle) { public function values($subtemplateTitle) {
$values = ''; $values = '';
if (have_rows('ascribe_values')) { if (have_rows('ascribe_values')) {
@ -707,6 +721,8 @@ class Subtemplate {
return $result; return $result;
} }
public function careers($subtemplateTitle) { public function careers($subtemplateTitle) {
$args = array( $args = array(
'post_type' => 'career', 'post_type' => 'career',
@ -735,6 +751,8 @@ class Subtemplate {
return $result; return $result;
} }
public function mediaDetail($subtemplateTitle) { public function mediaDetail($subtemplateTitle) {
$image = get_sub_field('image')['url']; $image = get_sub_field('image')['url'];