Homepage › Community Forums › Adapt Theme Support › Prevent default loop (home page)
If Slider Wide and Slider widgets are not used, the home page reverts to the default loop.
UNLESS I use Home Feature 1, 2, 3 & 4.
How do I tweak the php code to allow the other widgets to show when not using Slider Wide and Slider or the Home Feature widgets?
Which version are you using? You should be able to use whatever widgets you want without having to use the slider.
V 1.3
That’s what I thought, but it’s not working – I either have to use either Slider or Slider Wide and if I don’t use those I have to use Featured 1, 2, 3 & 4.
@Amy is it possible for you to create a temporary login so I can take a look at your files? FTP would be the safest way just incase we’ll need to edit one of the PHP files.
Do you have an FTP login? It’s much safer to edit files that way just in case there is a PHP error.
Ok, just got it figured out. I tried logging in but it didn’t give me access to any of the WP files.
Here’s what I noticed in the default home.php of the theme…..If you look near the top you’ll see this –
<?php
add_action( 'genesis_meta', 'adapt_home_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function adapt_home_genesis_meta() {
if ( is_active_sidebar( 'slider-wide' ) || is_active_sidebar( 'slider' ) || is_active_sidebar( 'welcome' ) || is_active_sidebar( 'home-feature-1' ) || is_active_sidebar( 'home-feature-2' ) || is_active_sidebar( 'home-feature-3' ) || is_active_sidebar( 'home-feature-4' ) ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_top' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_welcome' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_middle' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_middlewide' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_feature' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_bottom' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_bottom_message' );
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
}
}
All of the content right under the line – function adapt_home_genesis_meta() {
is supposed to look like this instead –
<?php
add_action( 'genesis_meta', 'adapt_home_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function adapt_home_genesis_meta() {
if ( is_active_sidebar( 'slider-wide' ) || is_active_sidebar( 'slider' ) || is_active_sidebar( 'welcome-wide' ) || is_active_sidebar( 'welcome-feature-1' ) || is_active_sidebar( 'welcome-feature-2' ) || is_active_sidebar( 'welcome-feature-3' ) || is_active_sidebar( 'home-middle-1' ) || is_active_sidebar( 'home-middle-2' ) || is_active_sidebar( 'home-middle-wide' ) || is_active_sidebar( 'home-feature-1' ) || is_active_sidebar( 'home-feature-2' ) || is_active_sidebar( 'home-feature-3' ) || is_active_sidebar( 'home-feature-4' ) || is_active_sidebar( 'home-bottom-sidebar-1' ) || is_active_sidebar( 'home-bottom-sidebar-2' ) || is_active_sidebar( 'home-bottom-message' ) ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_top' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_welcome' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_middle' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_middlewide' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_feature' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_bottom' );
add_action( 'genesis_after_header', 'adapt_home_loop_helper_bottom_message' );
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
}
}
There are missing widgets up top so that was why that was happening. The above code should fix it. I could have added in your WP editor, but I didn’t want to risk the site going down if there was an error (which is why I asked about the FTP)…..But it should work as I’ve tested it on a local install I have setup. I’ll also make sure to get this updated in the theme, so thanks for letting me know!
Bingo! Thanks!
You’re Welcome!