Created
February 22, 2015 09:56
-
-
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)
This file contains 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 | |
// 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