Last active
May 11, 2020 16:54
-
-
Save kdankov/5f921af0bc23ab99eb37e40aeeb128e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Name: ACF Sections | |
*/ | |
get_header(); | |
$fields = get_fields(); | |
foreach ( $fields as $prefix => $section ) { | |
$template_path = get_template_directory() . '/sections/' . $section['template_path'] . '.php'; | |
if ( file_exists( $template_path ) ) { | |
require $template_path; | |
} | |
} | |
get_footer(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Example Section | |
*/ | |
$section_title = $section['title']; | |
$short_desc = $section['description']; | |
$cta_primary = $section['cta_primary']; | |
$cta_secondary = $section['cta_secondary']; | |
$bgrd_desktop = $section['background_image_desktop']; | |
$bgrd_mobile = $section['background_image_mobile']; | |
if ( ! empty( $section['is_active'] ) ) { ?> | |
<section class="section-fullwidth section-image-hero-content"> | |
<div class="row align-right align-middle"> | |
<div class="column large-10 medium-12 small-24"> | |
<header class="section-heading"> | |
<h2 class="section-heading-title"><?php echo esc_html( $section_title ); ?></h2> | |
<?php if ( ! empty( $short_desc ) ) { ?> | |
<div class="section-heading-content"> | |
<p><?php echo esc_html( $short_desc ); ?></p> | |
</div> | |
<?php } ?> | |
<?php acf_link( $cta_primary ); ?> | |
</header> | |
</div> | |
</div> | |
</section> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment