Skip to content

Instantly share code, notes, and snippets.

@braddalton
Created April 8, 2018 20:21
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 braddalton/10c1ab92db0b5ee69bb7a6216016e2da to your computer and use it in GitHub Desktop.
Save braddalton/10c1ab92db0b5ee69bb7a6216016e2da to your computer and use it in GitHub Desktop.
Replace No Sidebar Pro Front Page Loop With Welcome Widget https://wp.me/p1lTu0-hs5
<?php
/**
* @author Brad Dalton
* @link https://wp.me/p1lTu0-hs5
*/
add_action( 'genesis_meta', 'ns_front_page_genesis_meta' );
function ns_front_page_genesis_meta() {
if ( is_active_sidebar( 'welcome-message' ) ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'ns_welcome_message' );
}
}
function ns_welcome_message() {
if ( get_query_var( 'paged' ) >= 2 )
return;
echo '<div class="full-screen"><div class="widget-area">';
echo '<h2 class="screen-reader-text">' . __( 'Welcome Content', 'no-sidebar' ) . '</h2>';
genesis_widget_area( 'welcome-message', array(
'before' => '<div class="welcome-message"><div class="wrap">',
'after' => '</div></div>',
) );
echo '</div></div>';
}
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment