Skip to content

Instantly share code, notes, and snippets.

@cdils
Last active August 29, 2015 14:15
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 cdils/dba41f3520cb30c5a5c0 to your computer and use it in GitHub Desktop.
Save cdils/dba41f3520cb30c5a5c0 to your computer and use it in GitHub Desktop.
Customize the home page loop on Utility Pro (see this tutorial -> http://www.carriedils.com/custom-front-page-loop/)
<?php //remove this entire line
// Full width layout
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
// Remove standard loop and replace with loop showing Posts, not Page content.
remove_action( 'genesis_loop', 'genesis_do_loop' );
// We've already removed the loop. We don't want to add this custom one in.
// add_action ( 'genesis_loop', 'utility_pro_front_loop' );
<?php //remove this entire line
// Display latest posts instead of static page
function utility_pro_front_loop() {
global $query_args;
genesis_custom_loop( wp_parse_args( $query_args, array(
'post_type' => 'post',
'category_name'=>'news',
'paged' => get_query_var( 'page' )
)
) );
}
<?php //remove this entire line
// Add this widget area in, if a widget is being used in this widget area
if ( $home_sidebars['the-widget-id-goes-here'] ) {
add_action( 'genesis_after_header', 'your_special_widget' );
}
<?php //remove this entire line
// Add a function that calls genesis_widget_area (this outputs your widget area)
function your_special_widget() {
genesis_widget_area(
'the-widget-id-goes-here',
array(
'before' => '<div class="your-css-class"><div class="wrap">',
'after' => '</div></div>',
)
);
}
<?php //remove this entire line
// Remove standard loop and replace with loop showing Posts, not Page content.
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action ( 'genesis_loop', 'utility_pro_front_loop' );
// Display latest posts instead of static page
function utility_pro_front_loop() {
global $query_args;
genesis_custom_loop( wp_parse_args( $query_args, array( 'post_type' => 'post', 'paged' => get_query_var( 'page' ) ) ) );
}
.home .site-inner {
display: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment