Created
April 8, 2018 20:21
-
-
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
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 | |
/** | |
* @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