Skip to content

Instantly share code, notes, and snippets.

@arkadiusjonczek
Created February 22, 2015 09:56
Show Gist options
  • Save arkadiusjonczek/cfd9e5a9455cc5029d2c to your computer and use it in GitHub Desktop.
Save arkadiusjonczek/cfd9e5a9455cc5029d2c to your computer and use it in GitHub Desktop.
WordPress: Custom Genesis front page with two feature boxes (above and under the content box)
<?php
// front-page.php
// set full width layout
add_filter ( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
// add section right after header without inner div box for full width
add_action( 'genesis_after_header', 'aj_feature_box' );
function aj_feature_box() {
?>
<div class="feature-box">
<div style="width: 100%; height: 500px; background: url(/wp-content/themes/genesis-sample-german/images/ipanema-beach_1920.jpg) center center no-repeat; background-size: cover; background-attachment: fixed;"></div>
</div>
<?php
}
// add section right before footer without inner div box for full width
add_action( 'genesis_before_footer', 'aj_feature_box2' );
function aj_feature_box2() {
?>
<div class="feature-box2">
<div style="width: 100%; height: 500px; background: url(/wp-content/themes/genesis-sample-german/images/mallorca_1920.jpg) center center no-repeat; background-size: cover; background-attachment: fixed;"></div>
</div>
<?php
}
// remove Genesis default loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
// add a custom loop
add_action( 'genesis_loop', 'aj_custom_loop' );
function aj_custom_loop () {
?>
<h1>Überschrift 1</h1>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
<div style="width: 100%; height: 500px; background: url(/wp-content/themes/genesis-sample-german/images/weimaraner_1280.jpg) center center no-repeat; background-size: cover;"></div>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
<h2>Überschrift 2</h2>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
<?php
}
// run Genesis Framework
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment