Last active
April 16, 2019 14:22
-
-
Save surefirewebserv/3860625 to your computer and use it in GitHub Desktop.
Simple Homepage Layout for Genesis Framework.
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 | |
add_action( 'genesis_after_header', 'sf_featured_slideshow' ); | |
/** | |
* Add slide show widget area after the header. | |
* | |
* @author Sure Fire Web Services | |
* @link http://surefirewebservices.com/?p=1542 | |
* | |
* @return Return null if not the homepage post. | |
*/ | |
function sf_featured_slideshow() { | |
if ( ! is_home() || ! is_front_page() ) | |
return; | |
genesis_widget_area( 'home-featured-slideshow', array( | |
'before' => '<div id="home-featured-slider" class="widget-area">', | |
) ); | |
} | |
add_action('get_header', 'sf_remove_loop'); | |
/** | |
* Remove Loop on Home Page Only | |
* | |
* @author Sure Fire Web Services | |
* @link http://surefirewebservices.com/?p=1542 | |
* | |
*/ | |
function sf_remove_loop() { | |
if ( ! is_home() || ! is_front_page() ) | |
return; | |
remove_action( 'genesis_loop', 'genesis_do_loop' ); | |
} | |
/** Remove Standard Loop */ | |
add_action( 'genesis_loop', 'sf_do_featured_boxes' ); | |
/** | |
* Add 3 featured boxes to the homepage. | |
* | |
* @author Sure Fire Web Services | |
* @link http://surefirewebservices.com/?p=1542 | |
* | |
* @return Return null if not the homepage post. | |
*/ | |
function sf_do_featured_boxes() { | |
if ( ! is_home() || ! is_front_page() ) | |
return; | |
remove_action( 'genesis_loop', 'genesis_do_loop' ); | |
echo '<div class="wrap">'; | |
genesis_widget_area( 'home-featured-1', array( | |
'before' => '<div id="home-featured-1" class="widget-area one-third first">', | |
) ); | |
genesis_widget_area( 'home-featured-2', array( | |
'before' => '<div id="home-featured-2" class="widget-area one-third">', | |
) ); | |
genesis_widget_area( 'home-featured-3', array( | |
'before' => '<div id="home-featured-3" class="widget-area one-third">', | |
) ); | |
echo '</div>'; | |
} | |
/** | |
* Register Home Page Widget Areas. | |
* | |
* @author Sure Fire Web Services | |
* @link http://surefirewebservices.com/?p=1542 | |
* | |
*/ | |
genesis_register_sidebar( | |
array( | |
'id' => 'home-featured-slideshow', | |
'name' => __( 'Feature Slideshow Area', 'themename' ), | |
'description' => __( 'This is the featured slide show area under the header.', 'themename' ), | |
) ); | |
genesis_register_sidebar( | |
array( | |
'id' => 'home-featured-1', | |
'name' => __( 'Home Featured Left', 'themename' ), | |
'description' => __( 'This is the featured left area on the homepage.', 'themename' ), | |
) ); | |
genesis_register_sidebar( | |
array( | |
'id' => 'home-featured-2', | |
'name' => __( 'Home Featured Middle', 'themename' ), | |
'description' => __( 'This is the featured middle area on the homepage.', 'themename' ), | |
) ); | |
genesis_register_sidebar( | |
array( | |
'id' => 'home-featured-3', | |
'name' => __( 'Home Featured Right', 'themename' ), | |
'description' => __( 'This is the featured right area on the homepage.', 'themename' ), | |
) ); |
sf_featured_slideshow & sf_featured_boxes should have ()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Commenting here for convenience.
foo, bar
notfoo,bar
.{
and}
on line 13 and 15 optional, as conditional action is only a single line.genesis_do_*
function, keep thedo
part in your new function name.fourcol
as a class name (it also goes against the WP standard of splitting words in class names with hyphens).=>
in multi-line arrays lined up with spaces, not tabs. Makes it easier to read values.array(
from line 47 should be on line 48, indented as'id'
currently is, and everything else moved down a line: