Skip to content

Instantly share code, notes, and snippets.

@braddalton
Created March 12, 2013 04:14
Show Gist options
  • Save braddalton/5140307 to your computer and use it in GitHub Desktop.
Save braddalton/5140307 to your computer and use it in GitHub Desktop.
This is a copy of the PHP code included in the Magazine child theme's home.php file and modified for use as a custom page template including widgets the same as the home page displays. I named this file custom.php in the child themes root directory.
<?php
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'magazine_custom_loop_helper' );
/*
Template Name: Custom
*/
function magazine_custom_loop_helper() {
if ( is_active_sidebar( 'custom-top' ) || is_active_sidebar( 'custom-left' ) || is_active_sidebar( 'custom-right' ) || is_active_sidebar( 'custom-bottom' ) ) {
if ( is_active_sidebar( 'custom-top' ) ) {
echo '<div class="custom-top">';
dynamic_sidebar( 'custom-top' );
echo '</div><!-- end .custom-top -->';
}
if ( is_active_sidebar( 'custom-left' ) || is_active_sidebar( 'custom-right' ) ) {
echo '<div class="custom-middle">';
if ( is_active_sidebar( 'custom-left' ) ) {
echo '<div class="custom-left">';
dynamic_sidebar( 'custom-left' );
echo '</div><!-- end .custom-left -->';
}
if ( is_active_sidebar( 'custom-right' ) ) {
echo '<div class="custom-right">';
dynamic_sidebar( 'custom-right' );
echo '</div><!-- end .custom-right -->';
}
echo '</div><!-- end .custom-middle -->';
}
if ( is_active_sidebar( 'custom-bottom' ) ) {
echo '<div class="custom-bottom">';
dynamic_sidebar( 'custom-bottom' );
echo '</div><!-- end .custom-bottom -->';
}
}
else {
genesis_standard_loop();
}
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment