Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function sk_display_fc() {
- // loop through the rows of data
- while ( have_rows('flexible_content') ) : the_row();
- if( get_row_layout() == 'hero' ) {
- $hero_image = get_sub_field( 'hero_image' ); ?>
- <div class="hero" style="background-image: url(<?php the_sub_field( 'hero_image' ); ?>);">
- <div class="dark-overlay">
- <div class="wrap">
- <?php the_sub_field( 'hero_text' );
- if( get_field( 'display_cta_button' ) ) { ?>
- <a href="<?php the_sub_field( 'hero_cta_button_url' ) ?>" class="button"><?php echo the_sub_field( 'hero_cta_button_text' );?></a>
- <?php } ?>
- </div>
- </div>
- </div>
- <?php
- } elseif( get_row_layout() == 'home_image_section' ) {
- $image = get_sub_field( 'home_image_section' );
- echo '<div class="row image home-section"><img src="' . $image['url'] . '" alt="' . $image['alt'] . '" /></div>';
- }
- endwhile;
- }
- add_action( 'get_header', 'sk_fc_check' );
- function sk_fc_check() {
- if( have_rows( 'flexible_content' ) ) {
- remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
- add_action( 'genesis_entry_content', 'sk_display_fc' );
- // Add support for structural wraps
- add_theme_support( 'genesis-structural-wraps', array(
- 'header',
- 'nav',
- 'subnav',
- // 'site-inner',
- 'footer-widgets',
- 'footer'
- ));
- add_filter( 'body_class', 'sk_body_class' );
- // Remove the entry title (requires HTML5 theme support)
- remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
- // Remove entry header markup
- remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
- remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
- }
- }
- function sk_body_class( $classes ) {
- $classes[] = 'flexible-content';
- return $classes;
- }
- genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement