Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php $image_accordion = get_field('accordion_main_image');
- if($image_accordion){ echo "Mikko"; } ?>
- <?php if( have_rows( 'accordion' ) ): $counter = 0 ?>
- <div class="row left-right direction--<?php echo $direction; ?>">
- <div class="col col-12 col-md-7">
- <div class="image-container animate--<?php echo $direction; ?>">
- <?php
- if( !empty( $image ) ): ?>
- <img src="<?php echo esc_url($image['url']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
- <?php endif; ?>
- <?php
- echo wp_get_attachment_image( $image, 'large' ); ?>
- </div>
- </div>
- <div class="col col-12 col-md-5">
- <div class="text-container">
- <div class="accordion-items accordion-items__light">
- <?php
- //note that $direction is available from module-left_right
- while( have_rows( 'accordion' ) ):
- the_row();
- ?>
- <div class="accordion-item">
- <div class="accordion-heading <?php if( $counter == 0 ) { ?> active<?php } ?>"><?php the_sub_field('sub_heading'); ?></div>
- <div class="accordion-content" style="<?php if( $counter == 0 ) { ?> display:block;<?php } ?>">
- <h4><?php the_sub_field('main_heading'); ?></h4>
- <p><?php the_sub_field('accordion_content'); ?></p>
- <?php $link = get_sub_field('button');
- if( $link ):
- $link_url = $link['url'];
- $link_title = $link['title'];
- $link_target = $link['target'] ? $link['target'] : '_self';
- ?>
- <div class="accordion-cta">
- <a href="<?php echo $link_url; ?>" target="<?php echo $link_target; ?>" class="button-secondary"><?php echo $link_title; ?></a>
- </div>
- <?php endif; ?>
- </div>
- </div>
- <?php $counter++; endwhile; ?>
- </div>
- </div>
- </div>
- </div>
- <?php endif; ?>
- <script>
- jQuery(function() {
- jQuery(".accordion-items").on("click", ".accordion-heading", function () {
- jQuery(this).toggleClass("active").next().slideToggle();
- jQuery(".accordion-content").not(jQuery(this).next()).slideUp(300);
- jQuery(this).parent().siblings().find(".accordion-heading").removeClass("active");
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement