Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_action( 'genesis_after_header', 'cyc_mid_section', 15 );
- function cyc_mid_section() {
- // check if the flexible content field has rows of data
- if( have_rows( 'page_builder' ) ) {
- // loop through the rows of data ?
- while ( have_rows( 'page_builder' ) ) : the_row();
- if ( get_row_layout() == 'gallery_row' ) {
- // check if the repeater field has rows of data
- if( have_rows( 'frontpage_gallery' ) ) {
- echo '<div class="wrap fp-gallery">' ;
- if ( is_main_site() ) {
- echo '<h2>Our Venues - Quick Access</h2>';
- } else {
- echo '<h2>Our Features</h2>';
- }
- $i = 0;
- while ( have_rows( 'frontpage_gallery' ) ) : the_row();
- $i++;
- if( $i % 3 == 1) { // this says, if the item number is divisible by 3 then
- $class = 'first' ; // add this class
- $i = 1; // then reset the counter back to 1
- }
- else {
- $class = ''; //otherwise don't output anything
- $image = wp_get_attachment_image_src( get_sub_field( 'gallery_image' ), 'gallery-feature' ); ?>
- <a href="<?php the_sub_field( 'gallery_link' ) ?>">
- <div class="one-third <?php echo $class ?>">
- <div class="fp-gallery-container">
- <?php if( get_sub_field( 'gallery_image_logo' ) ): ?>
- <div class="fp-gallery-overlay" style="background: url(<?php the_sub_field( 'gallery_image_logo' ) ?> ) no-repeat; ">
- </div>
- <?php endif; ?>
- <div class="fp-gallery-image">
- <img src="<?php echo $image[0]; ?>" alt="<?php echo the_sub_field( 'gallery_image_caption' ) ?>" />
- </div>
- <div class="fp-gallery--caption <?php the_sub_field( 'gallery_colour_scheme' ) ?>">
- <?php the_sub_field( 'gallery_image_caption' ) ?><span class="fa-stack"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-play fa-stack-1x fa-inverse"></i></span>
- </div>
- </div>
- </div>
- </a>
- <?php } endwhile;
- ?></div><!-- end fp-gallery -->
- <?php }
- else {
- // no rows found
- }
- }
- }
- endwhile;
- else {
- // no layouts found
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement