Skip to content

Instantly share code, notes, and snippets.

@gregoirenoyelle
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregoirenoyelle/daa02202bd039b52f645 to your computer and use it in GitHub Desktop.
Save gregoirenoyelle/daa02202bd039b52f645 to your computer and use it in GitHub Desktop.
Genesis front page
<?php
/**
* Home page with Widget for Sample Theme
*
* @author Grégoire Noyelle
* @package Sample Theme
* @subpackage Customizations
*/
add_action( 'genesis_meta', 'gn_sample_home_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function gn_sample_home_genesis_meta() {
if ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-bottom' ) ) {
//* Force full-width-content layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
//* Add gn-sample-home body class
add_filter( 'body_class', 'gn_sample_body_class' );
//* Remove breadcrumbs
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
//* Remove the default Genesis loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
//* Add home top widgets
add_action( 'genesis_loop', 'gn_sample_home_top_widgets' );
//* Add home bottom widgets
add_action( 'genesis_before_footer', 'gn_sample_home_bottom_widgets', 1 );
}
}
function gn_sample_body_class( $classes ) {
$classes[] = 'gn-sample-home';
return $classes;
}
function gn_sample_home_top_widgets() {
genesis_widget_area( 'home-top', array(
'before' => '<div class="home-top widget-area">',
'after' => '</div>',
) );
}
function gn_sample_home_bottom_widgets() {
genesis_widget_area( 'home-bottom', array(
'before' => '<div class="home-bottom widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
genesis();
/* Suplément page Accueil DEBUT */
@media only screen and (max-width: 800px) {
.content #genesis-responsive-slider .flex-direction-nav li .next,
.content #genesis-responsive-slider .flex-direction-nav li .prev,
.content .slide-excerpt {
display: none;
}
.home-bottom .widget {
text-align: center;
width: 48%;
}
.home-bottom .widget:nth-of-type(2n) {
clear: none;
margin-left: 2.564102564102564%;
}
.home-bottom .widget:nth-of-type(2n+1) {
clear: both;
margin-left: 0;
}
.gn-sample-home .site-inner .wrap {
padding: 0;
}
}
@media only screen and (max-width: 480px) {
.content {
padding: 30px;
}
.content #genesis-responsive-slider .flex-control-nav {
display: none;
}
.home-bottom .widget:nth-of-type(2n),
.home-bottom .widget {
margin: 0;
width: 100%;
}
}
/* Suplément page Accueil FIN */
/* Suplément page Accueil DEBUT */
/* Accueil
--------------------------------------------- */
.home-top .widget {
margin: 0;
padding: 0 40px 40px;
}
.home-top .widget:first-child {
padding-top: 40px;
}
.home-top .widget.genesis_responsive_slider {
padding: 0;
}
.outreach-pro-home .content {
padding: 0;
}
.home-bottom {
background-color: #fff;
padding-top: 60px;
}
.home-bottom .widget {
float: left;
margin-left: 2.564102564102564%;
width: 23.076923076923077%;
}
.home-bottom .widget:nth-child(4n+1) {
clear: both;
margin-left: 0;
}
.home-bottom .featured-content img {
-webkit-box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
}
.home-bottom .widget-title {
color: #333;
font-weight: 700;
}
.gn-sample-home .content {
margin: 0;
}
/* Suplément page Accueil FIN */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment