ID;
$result = '';
if (have_rows('subtemplate',$id)) {
while (have_rows('subtemplate',$id)) {
the_row();
$subtemplateType = get_sub_field('subtemplate_type');
$subtemplateTitle = get_sub_field('section_title');
$subtemplate = '';
switch ($subtemplateType) {
case 'featurecircles':
$result .= $this->featureCircles($subtemplate,$subtemplateTitle);
break;
case 'casestudies':
$result .= $this->caseStudies($subtemplate,$subtemplateTitle);
break;
case 'oldnew':
$result .= $this->oldNew($subtemplate,$subtemplateTitle);
break;
case 'productoverview':
$result .= $this->productOverview($subtemplate,$subtemplateTitle);
break;
case 'bluebox':
$result .= $this->blueBox($subtemplate,$subtemplateTitle);
break;
case 'createaccount':
$result .= $this->createAccount($subtemplate,$subtemplateTitle);
break;
case 'galleries':
$result .= $this->galleries($subtemplate,$subtemplateTitle);
break;
case 'blogfeatures':
$result .= $this->blogFeatures($subtemplate,$subtemplateTitle);
break;
case 'mediafeature':
$result .= $this->mediaFeature($subtemplate,$subtemplateTitle);
break;
case 'team':
$result .= $this->team($subtemplate,$subtemplateTitle);
break;
case 'content':
$result .= $this->content($subtemplate,$subtemplateTitle);
break;
case 'image':
$result .= $this->image($subtemplate,$subtemplateTitle);
break;
case 'faq':
$result .= $this->faq($subtemplate,$subtemplateTitle);
break;
case 'values':
$result .= $this->values($subtemplate,$subtemplateTitle);
break;
case 'careers':
$result .= $this->careers($subtemplate,$subtemplateTitle);
break;
case 'mediadetail':
$result .= $this->mediaDetail($subtemplate,$subtemplateTitle);
break;
case 'download':
$result .= $this->download($subtemplate,$subtemplateTitle);
break;
}
}
}
return $result;
}
public function featureCircles($subtemplate,$subtemplateTitle) {
$featureCircles = '';
if (have_rows('feature_circles')) {
while (have_rows('feature_circles')) {
the_row();
$title = get_sub_field('title');
$icon = get_sub_field('icon')['url'];
$description = get_sub_field('description');
$featureCircles .= "
{$title}
{$description}
";
}
}
$result = "";
return $result;
}
public function caseStudies($subtemplate,$subtemplateTitle) {
$caseStudies = '';
if (have_rows('case_study')) {
while (have_rows('case_study')) {
the_row();
$content = get_sub_field('content');
$bgImage = get_sub_field('background_image')['url'];
$caseStudies .= "
";
}
}
$result = "";
return $result;
}
public function oldNew($subtemplate,$subtemplateTitle) {
$oldNewRows = '';
if (have_rows('old_way__new_way')) {
while (have_rows('old_way__new_way')) {
the_row();
$oldway = get_sub_field('old_way_text');
$newway = get_sub_field('new_way_text');
$oldNewRows .= "
{$oldway} |
{$newway} |
";
}
}
$result = "
{$subtemplateTitle}
Old Way | New Way |
{$oldNewRows}
";
return $result;
}
public function productOverview($subtemplate,$subtemplateTitle) {
$imageUrl = get_sub_field('image')['url'];
$imageAlt = get_sub_field('image')['alt'];
$content = get_sub_field('content');
$result = "
{$subtemplateTitle}
{$content}
";
return $result;
}
public function blueBox($subtemplate,$subtemplateTitle) {
$content = get_sub_field('content');
$result = "
{$subtemplateTitle}
{$content}
";
return $result;
}
public function createAccount($subtemplate,$subtemplateTitle) {
$buttonText = get_sub_field('create_free_account_text');
$signUpLink = get_field('sign_up_link','option');
$backgroundImg = get_sub_field('image')['url'];
$result = "";
return $result;
}
public function galleries($subtemplate,$subtemplateTitle) {
$galleryLink = get_sub_field('gallery_page');
$galleriesImgUrl = get_sub_field('galleries_image')['url'];
$galleriesImgAlt = get_sub_field('galleries_image')['alt'];
$result = "";
return $result;
}
public function blogFeatures($subtemplate,$subtemplateTitle) {
$blogFeatures = '';
if (have_rows('blog_features')) {
while (have_rows('blog_features')) {
the_row();
$title = get_sub_field('feature_title');
$feature = get_sub_field('post');
$postTitle = $feature->post_title;
$url = get_permalink($feature->ID);
$image = wp_get_attachment_image_src(get_post_thumbnail_id($feature->ID),'large')[0];
$blogFeatures .= "
{$title}
{$postTitle}
";
}
}
$result = "";
return $result;
}
public function mediaFeature($subtemplate,$subtemplateTitle) {
$mediaLink = get_sub_field('media_link');
$mediaImgUrl = get_sub_field('media_feature_image')['url'];
$mediaImgAlt = get_sub_field('media_feature_image')['alt'];
$result = "";
return $result;
}
public function team($subtemplate,$subtemplateTitle) {
$content = get_sub_field('content');
$meetTeamLink = get_sub_field('meet_the_team_link');
$args = array(
'post_type' => 'team',
'order' => 'ASC'
);
$teamMembers = get_posts($args);
$teamMemberMarkup = '';
if (!empty($teamMembers)) {
foreach ($teamMembers as $teamMember) {
$id = $teamMember->ID;
$name = $teamMember->post_title;
$role = get_field('role',$id);
$image = get_field('image',$id)['url'];
$facebook = get_field('facebook_link',$id);
if ($facebook) {
$facebook = "Facebook";
}
$github = get_field('github_link',$id);
if ($github) {
$github = "Github";
}
$linkedin = get_field('linkedin_link',$id);
if ($linkedin) {
$linkedin = "Linkedin";
}
$twitter = get_field('twitter_link',$id);
if ($twitter) {
$twitter = "Twitter";
}
$teamMemberMarkup .= "
{$name}
{$role}
{$facebook}
{$github}
{$linkedin}
{$twitter}
";
}
}
$result = "";
return $result;
}
public function content($subtemplate,$subtemplateTitle) {
$content = get_sub_field('content');
$result = "
{$subtemplateTitle}
{$content}
";
return $result;
}
public function image($subtemplate,$subtemplateTitle) {
$image = get_sub_field('image')['url'];
$imageAlt = get_sub_field('image')['alt'];
$result = "";
return $result;
}
public function faq($subtemplate,$subtemplateTitle) {
$featuredFAQ = '';
if (have_rows('featured_faqs')) {
while (have_rows('featured_faqs')) {
the_row();
$question = get_sub_field('question');
$answer = get_sub_field('answer');
$featuredFAQ .= "- {$question}
- {$answer}
";
}
}
$featuredFAQ .= "
";
$regularFAQ = '';
if (have_rows('regular_faqs')) {
while (have_rows('regular_faqs')) {
the_row();
$question = get_sub_field('question');
$answer = get_sub_field('answer');
$regularFAQ .= "- Q: {$question}
- A: {$answer}
";
}
}
$regularFAQ .= "
";
$result = "
{$subtemplateTitle}
{$featuredFAQ}
{$regularFAQ}
";
return $result;
}
public function values($subtemplate,$subtemplateTitle) {
$values = '';
if (have_rows('ascribe_values')) {
while (have_rows('ascribe_values')) {
the_row();
$title = get_sub_field('value_title');
$description = get_sub_field('value_description');
$values .= "
{$title}
{$description}
";
}
}
$result = "";
return $result;
}
public function careers($subtemplate,$subtemplateTitle) {
$args = array(
'post_type' => 'career',
'order' => 'ASC'
);
$careers = get_posts($args);
$careerMarkup = '';
if (!empty($careers)) {
foreach ($careers as $career) {
$id = $career->ID;
$name = $career->post_title;
$url = get_permalink($id);
$careerMarkup .= "{$name}";
}
}
$result = "";
return $result;
}
public function mediaDetail($subtemplate,$subtemplateTitle) {
$args = array(
'post_type' => 'presscoverage',
'order' => 'ASC'
);
$pressItems = get_posts($args);
$pressMarkup = '';
if (!empty($pressItems)) {
foreach ($pressItems as $item) {
$id = $item->ID;
$name = $item->post_title;
$url = get_field('link_to_article',$id);
$pubDate= get_field('date_published',$id);
$quote = get_field('quote',$id);
$pressMarkup .= "
{$quote}
";
}
}
$result = "
{$subtemplateTitle}
{$pressMarkup}
";
return $result;
}
public function download($subtemplate,$subtemplateTitle) {
$leftUrl = get_sub_field('left_button_url');
$leftText = get_sub_field('left_button_text');
$rightUrl = get_sub_field('right_button_url');
$rightText = get_sub_field('right_button_text');
$result = "";
return $result;
}
}