Created
October 13, 2016 08:28
-
-
Save ciaranha/e51f8b0e298334ae862aad3f00ecfe12 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: About Page Sidebar | |
* Description: Template used for general pages with left sidebar | |
*/ | |
//* Add custom body class | |
add_filter( 'body_class', 'childthemeprefix_home_page_class' ); | |
function childthemeprefix_home_page_class( $classes ) { | |
$classes[] = 'general-sidebar-page'; | |
return $classes; | |
} | |
/*removes page title & body*/ | |
remove_action( 'genesis_loop', 'genesis_do_loop' ); | |
add_action( 'genesis_loop', 'generalsidebar_custom_loop' ); | |
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); | |
function generalsidebar_custom_loop() { ?> | |
<section class="container"> | |
<div class="col-md-4 sidebar-left"> | |
<div class="sidebar-pic"> | |
<img src="http://placehold.it/360x275"> | |
</div> | |
<div class="sidebar-tabs"> | |
<?php echo do_shortcode('[wpb_childpages]'); ?> | |
</div> | |
</div> | |
<div class="col-md-8"> | |
<?php | |
// check if the repeater field has rows of data | |
if( have_rows('section') ): | |
// loop through the rows of data | |
while ( have_rows('section') ) : the_row(); | |
// display a sub field value | |
echo '<h2>'; | |
the_sub_field('title'); | |
echo '</h2>'; | |
the_sub_field('body_text'); | |
// check if the flexible content field has rows of data | |
if( have_rows('add_content_type') ): | |
// loop through the rows of data | |
while ( have_rows('add_content_type') ) : the_row(); | |
if( get_row_layout() == 'download_links' ): | |
echo '<a class="download-link" target="_blank" href="'; | |
the_sub_field('download_file'); | |
echo '">'; | |
echo '<div class="download-link-inner">'; | |
the_sub_field('download_link_text'); | |
echo '</div>'; | |
echo '</a>'; ?> | |
<?php elseif( get_row_layout() == 'slider' ): ?> | |
<?php $images = get_sub_field('slider_shortcode'); | |
if( $images ): ?> | |
<?php | |
$images = get_sub_field('slider_shortcode'); | |
echo '<pre>'; | |
var_dump( $images ); | |
echo '</pre>'; | |
?> | |
<div id="general-slider"> | |
<?php foreach( $images as $image ): ?> | |
<div class="item"> | |
<img class="slide" src="<?php echo $image['sizes']['slidersize']; ?>" alt="<?php echo $image['alt']; ?>" /> | |
<div class="slide-content"> | |
<?php echo $image['title'];?> | |
</div> | |
</div> | |
<?php endforeach; ?> | |
</div> | |
<?php endif; ?> | |
<?php endif; | |
endwhile; | |
else : | |
// no layouts found | |
endif; | |
endwhile; | |
else : | |
// no rows found | |
endif; | |
?> | |
</div> | |
</section> | |
<?php } | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment