Skip to content

Instantly share code, notes, and snippets.

@ximosa
Last active March 11, 2018 17:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ximosa/513bf43b244a2679c7aa to your computer and use it in GitHub Desktop.
Save ximosa/513bf43b244a2679c7aa to your computer and use it in GitHub Desktop.
Crear pagina de incio en genesis con widgets
<?php
/**
* crear pagina de inicio.
*
* @author webgae
* @front-page.php
*/
//* Eliminar breadcrumbs
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
//* Eliminar Genesis loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
//* Agregar function
add_action( 'genesis_after_header', 'front_page_widgets' );
//* Agregar stylo personal a la página
add_filter( 'body_class', 'estilo_body_class' );
function estilo_body_class( $classes ) {
$classes[] = 'front-page';
return $classes;
}
//* Agregar los widgets
function front_page_widgets() {
genesis_widget_area( 'front-page-1', array(
'before' => '<div class="front-page-1"><div class="image-section"><div class="flexible-widgets widget-area">',
'after' => '</div></div></div>',
) );
genesis_widget_area( 'front-page-2', array(
'before' => '<div class="front-page-2"><div class="solid-section"><div class="flexible-widgets widget-area">',
'after' => '</div></div></div>',
) );
genesis_widget_area( 'front-page-3', array(
'before' => '<div class="front-page-3"><div class="image-section"><div class="flexible-widgets widget-area">',
'after' => '</div></div></div>',
) );
genesis_widget_area( 'front-page-4', array(
'before' => '<div class="front-page-4"><div class="solid-section"><div class="flexible-widgets widget-area">',
'after' => '</div></div></div>',
) );
genesis_widget_area( 'front-page-5', array(
'before' => '<div class="front-page-5"><div class="image-section"><div class="flexible-widgets widget-area">',
'after' => '</div></div></div>',
) );
genesis_widget_area( 'front-page-6', array(
'before' => '<div class="front-page-6"><div class="solid-section"><div class="flexible-widgets widget-area">',
'after' => '</div></div></div>',
) );
genesis_widget_area( 'front-page-7', array(
'before' => '<div class="front-page-7"><div class="image-section"><div class="flexible-widgets widget-area">',
'after' => '</div></div></div>',
) );
}
genesis();
//*Agregamos a functions.php de tu tema hijo de genesis
//* Registrar widget areas
genesis_register_sidebar( array(
'id' => 'front-page-1',
'name' => __( 'Front Page 1'),
'description' => __( 'Esto es front page 1 section.'),
) );
genesis_register_sidebar( array(
'id' => 'front-page-2',
'name' => __( 'Front Page 2'),
'description' => __( 'Esto es front page 2 section.'),
) );
genesis_register_sidebar( array(
'id' => 'front-page-3',
'name' => __( 'Front Page 3'),
'description' => __( 'Esto es front page 3 section.' ),
) );
genesis_register_sidebar( array(
'id' => 'front-page-4',
'name' => __( 'Front Page 4'),
'description' => __( 'Esto es front page 4 section.'),
) );
genesis_register_sidebar( array(
'id' => 'front-page-5',
'name' => __( 'Front Page 5'),
'description' => __( 'Esto es front page 5 section.'),
) );
genesis_register_sidebar( array(
'id' => 'front-page-6',
'name' => __( 'Front Page 6'),
'description' => __( 'Esto es front page 6 section.'),
) );
genesis_register_sidebar( array(
'id' => 'front-page-7',
'name' => __( 'Front Page 7'),
'description' => __( 'Esto es front page 7 section.'),
) );
/*Agregamos estilos a Front Page
--------------------------------------------- */
.front-page .site-container .site-inner {
margin-top: 0;
max-width: 100%;
}
.image-section,
.solid-section {
clear: both;
text-align: center;
width: 100%;
}
.image-section .widget-title {
color: #fff;
}
.solid-section{
display: table;
overflow: hidden;
table-layout: fixed;
width: 100%;
}
.image-section {
background: -moz-linear-gradient(top, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.5) 30%, rgba(0,0,0,0.8) 80%, rgba(0,0,0,0.9) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.2)), color-stop(30%,rgba(0,0,0,0.5)), color-stop(80%,rgba(0,0,0,0.8)), color-stop(100%,rgba(0,0,0,0.9)));
background: -webkit-linear-gradient(top, rgba(0,0,0,0.2) 0%,rgba(0,0,0,0.5) 30%,rgba(0,0,0,0.8) 80%,rgba(0,0,0,0.9) 100%);
background: -o-linear-gradient(top, rgba(0,0,0,0.2) 0%,rgba(0,0,0,0.5) 30%,rgba(0,0,0,0.8) 80%,rgba(0,0,0,0.9) 100%);
background: -ms-linear-gradient(top, rgba(0,0,0,0.2) 0%,rgba(0,0,0,0.5) 30%,rgba(0,0,0,0.8) 80%,rgba(0,0,0,0.9) 100%);
background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%,rgba(0,0,0,0.5) 30%,rgba(0,0,0,0.8) 80%,rgba(0,0,0,0.9) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#33000000', endColorstr='#e6000000',GradientType=0 );
display: table;
overflow: hidden;
table-layout: fixed;
width: 100%;
}
.image-section .widget-area {
display: table-cell;
text-align: center;
vertical-align: middle;
}
.image-section,
.image-section a {
color: #fff;
}
.image-section a:hover,
.image-section .featured-content .entry-title a:hover {
color: #22a1c4;
}
.solid-section {
background-color: #fff;
}
.front-page-2,
.front-page-3,
.front-page-4,
.front-page-5,
.front-page-6,
.front-page-7 {
border-top: 54px solid transparent;
margin-top: -54px;
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
position: relative;
z-index: 9;
}
.front-page-1,
.front-page-3,
.front-page-5,
.front-page-7 {
background-attachment: fixed;
background-color: #fff;
background-position: 50% 0;
background-repeat: no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
.front-page-1 {
position: relative;
}
.front-page-1 .image-section {
padding-top: 75px;
}
/* Flexible Widgets
--------------------------------------------- */
.flexible-widgets {
padding-bottom: 100px;
padding-top: 100px;
}
.flexible-widgets .widget {
float: left;
margin: 0 0 40px 2.564102564102564%;
}
.flexible-widgets.widget-full .widget,
.flexible-widgets.widget-area .widget:nth-of-type(1),
.flexible-widgets.widget-halves.uneven .widget:last-of-type {
background: none;
margin-left: 0;
padding: 0;
width: 100%;
}
.widget-area.flexible-widgets.widget-half .widget,
.flexible-widgets.widget-halves .widget {
width: 48.717948717948715%;
}
.flexible-widgets.widget-thirds .widget {
width: 31.623931623931625%;
}
.flexible-widgets.widget-fourths .widget {
width: 23.076923076923077%;
}
.flexible-widgets.widget-halves .widget:nth-child(even),
.flexible-widgets.widget-thirds .widget:nth-child(3n+2),
.flexible-widgets.widget-fourths .widget:nth-child(4n+2) {
clear: left;
margin-left: 0;
}
.solid-section .widget {
background-color: #fff;
padding: 40px;
}
.solid-section .widget-title {
border-bottom: 1px solid #ddd;
margin-bottom: 30px;
padding-bottom: 30px;
}
.flexible-widgets.widget-halves h2,
.flexible-widgets.widget-thirds h2,
.flexible-widgets.widget-fourths h2 {
font-size: 36px;
}
.wrap {
float: none;
margin: 0 auto;
max-width: 1200px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment