Last active
March 7, 2018 15:08
-
-
Save brigleb/b0fc58980710a9503f868a159c9581d9 to your computer and use it in GitHub Desktop.
How I like to load ACF loops. `front-page.php` is an example template, calling multiple layouts. Alternately, the second example just finds out what layouts are used and calls them by name. Note the underscore is used in place of a forward slash.
This file contains 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
<main> | |
<?php get_template_part( 'parts/layouts/home', 'intro' ); ?> | |
<?php get_template_part( 'parts/layouts/home', 'slider' ); ?> | |
<?php get_template_part( 'parts/product', 'grid' ); ?> | |
<?php get_template_part( 'parts/layouts/home', 'outro' ); ?> | |
<?php // or, you can just try to load them ALL, from the next template ?> | |
<?php get_template_part('parts/content', 'layouts'); ?> | |
</main> |
This file contains 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 $block_count = 0; | |
if( have_rows('page_content') ) { | |
while ( have_rows('page_content') ) { the_row(); ?> | |
<section id="block_<?php echo $block_count; ?>" class="<?php echo get_row_layout();?>"> | |
<?php get_template_part( 'parts/layouts/page', get_row_layout() ); ?> | |
</section> | |
<?php } | |
} else { | |
?> | |
<p class="center">You haven't added any layouts yet. <?php edit_post_link('Add one now.'); ?></p> | |
<?php | |
} | |
?> |
This file contains 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 | |
$background_image = get_sub_field( 'background_image' ); | |
if ( get_sub_field( 'foreground_color' ) == 0 ) { | |
$foreground_color = ' light'; | |
} | |
?> | |
<div class="clearfix scratch-bg<?php echo $foreground_color; ?>" <?php if ( $background_image ) { ?> style="width: 100%; min-height: 50vh; background-image: url('<?php echo $background_image['url']; ?>');<?php } ?> background-color: <?php the_sub_field( 'background_color' ); ?>"> | |
<div class="wrap hpad contain wow fadeIn" data-wow-duration="1s"> | |
<h2><?php the_sub_field( 'title' ); ?></h2> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment