Skip to content

Instantly share code, notes, and snippets.

@chrismcintosh
Created April 24, 2017 03:46
Show Gist options
  • Save chrismcintosh/c665c1e660941f4b83166083d2139140 to your computer and use it in GitHub Desktop.
Save chrismcintosh/c665c1e660941f4b83166083d2139140 to your computer and use it in GitHub Desktop.
<?php
// Define ACF component markup
function sby_display_flexible_content() {
// loop through the rows of data
while ( have_rows('flexible_content') ) : the_row();
// List Components for ACF Page Builder
if( get_row_layout() == 'department_intro' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/department-intro.php';
} elseif( get_row_layout() == 'featured_actions' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/featured-actions.php';
} elseif( get_row_layout() == 'grouped_actions' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/grouped-actions.php';
} elseif( get_row_layout() == 'quick_actions' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/quick-actions.php';
} elseif( get_row_layout() == 'featured_article' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/featured-article.php';
} elseif( get_row_layout() == 'tweets' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/tweets.php';
} elseif( get_row_layout() == 'hero' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/hero.php';
} elseif( get_row_layout() == 'news' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/news.php';
} elseif( get_row_layout() == 'staff' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/staff.php';
} elseif( get_row_layout() == 'gallery' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/gallery.php';
} elseif( get_row_layout() == 'event_query' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/event-list.php';
} elseif( get_row_layout() == 'blank' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/blank.php';
} elseif( get_row_layout() == 'expandables' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/expandables.php';
} elseif( get_row_layout() == 'video' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/video.php';
} elseif( get_row_layout() == 'social_media_links' ) {
include get_stylesheet_directory() . '/lib/acf/flexible-components/social-links.php';
}
endwhile;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment