Created
July 1, 2016 00:23
-
-
Save rgadon107/0bdd036558b51d21f2e64d156c1a6b3c to your computer and use it in GitHub Desktop.
Excerpt of child theme `front-page.php` file, demonstrating setup of home page widgets
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 | |
namespace albemishpc\front_page; | |
/** | |
* Front page for the Utility Pro theme | |
* | |
* @package Utility_Pro | |
* @author Carrie Dils | |
* @license GPL-2.0+ | |
*/ | |
add_action( 'genesis_meta', __NAMESPACE__ . '\utility_pro_homepage_setup' ); | |
/** | |
* Set up the homepage layout by conditionally loading sections when widgets | |
* are active. | |
* | |
* @since 1.0.0 | |
*/ | |
function utility_pro_homepage_setup() { | |
// Only show home page widgets on page 1. | |
if ( 1 === $page ) { | |
// Pull in header template customizations & render on front page. | |
include( CHILD_DIR . '/lib/structure/header.php' ); | |
// Add home welcome area if "Home Welcome" widget area is active. | |
if ( $home_sidebars['home_welcome'] ) { | |
add_action( 'genesis_after_header', __NAMESPACE__ . '\utility_pro_add_home_welcome' ); | |
} | |
// Add home gallery area if "Home Gallery 1" widget area is active. | |
if ( $home_sidebars['home_gallery_1'] ) { | |
add_action( 'genesis_after_header', __NAMESPACE__ . '\utility_pro_add_home_gallery' ); | |
} | |
// Add call to action area if "Call to Action" widget area is active. | |
if ( $home_sidebars['call_to_action'] ) { | |
add_action( 'genesis_after_header', __NAMESPACE__ . '\utility_pro_add_call_to_action' ); | |
} | |
// Add display posts area if "Display Posts" widget area is active. | |
if ( $home_sidebars['display_posts'] ) { | |
add_action( 'genesis_after_content_sidebar_wrap', __NAMESPACE__ . '\add_display_posts' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Initial commit. See line 25 for
include()
. That pulls in the header template customizations and renders them on the front page.