Community Forums › Forums › Archived Forums › General Discussion › agency theme reorder widgets on home page
Tagged: agency home page widgets
- This topic has 7 replies, 3 voices, and was last updated 10 years, 7 months ago by Brad Dalton.
-
AuthorPosts
-
September 19, 2013 at 10:40 am #63385bluedaisygraphicsParticipant
I was wondering if i could reorder the welcome widget and the slider widget
http://64.31.38.66/~montserr/
i'd like the slider to be before the welcome?September 19, 2013 at 12:52 pm #63413Brad DaltonParticipantSimply swap the names for the widget i.d's in your home.php file.
<?php add_action( 'genesis_meta', 'agency_home_genesis_meta' ); /** * Add widget support for homepage. If no widgets active, display the default loop. * */ function agency_home_genesis_meta() { if ( is_active_sidebar( 'home-slider' ) || is_active_sidebar( 'home-welcome' ) || is_active_sidebar( 'home-left' ) || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-right' ) ) { remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_after_header', 'agency_home_welcome_helper' ); add_action( 'genesis_loop', 'agency_home_loop_helper' ); add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); add_filter( 'body_class', 'add_body_class' ); function add_body_class( $classes ) { $classes[] = 'agency'; return $classes; } } } function agency_home_welcome_helper() { if ( is_active_sidebar( 'home-slider' ) ) { echo '<div id="home-slider">'; dynamic_sidebar( 'home-slider' ); echo '</div><!-- end #home-slider -->'; } if ( is_active_sidebar( 'home-welcome' ) ) { echo '<div id="home-welcome">'; dynamic_sidebar( 'home-welcome' ); echo '</div><!-- end #home-welcome -->'; } } function agency_home_loop_helper() { if ( is_active_sidebar( 'home-left' ) || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-right' ) ) { echo '<div id="home">'; echo '<div class="home-left">'; dynamic_sidebar( 'home-left' ); echo '</div><!-- end .home-left -->'; echo '<div class="home-middle">'; dynamic_sidebar( 'home-middle' ); echo '</div><!-- end .home-middle -->'; echo '<div class="home-right">'; dynamic_sidebar( 'home-right' ); echo '</div><!-- end .home-right -->'; echo '</div><!-- end #home -->'; } } genesis();
You may also want to modify the CSS:
/* Home Welcome ------------------------------------------------------------ */ #home-welcome { padding: 20px 30px; } #home-welcome, #home-welcome p { color: #333; font-size: 18px; text-align: center; text-shadow: none; } #home-welcome h4 { color: #333; font-size: 36px; line-height: 1; text-align: center; }
Paste the CSS code before the Responsive Design section near the end of the file.
September 19, 2013 at 1:09 pm #63418Brad DaltonParticipantOr you could leave the div i.d's the way they are and just change the sidebar i.d's
September 25, 2013 at 4:42 pm #64177scaughtMemberHow would I place the home-left, home-middle, and home-right content above the slider and welcome widget area? Tried swapping locations of the functions, didn't work.
September 25, 2013 at 6:54 pm #64218Brad DaltonParticipantYou also need to move the code for the home middle widgets above the code for the slider in the file.
September 25, 2013 at 7:22 pm #64225scaughtMemberThat's exactly what I did. I swapped the placement of function agency_home_loop_helper() and function agency_home_welcome_helper(). Home_Loop on top, Home_Welcome below. The welcome/slider still shows above the the home-left, home-middle, and home-right content.
I noticed the home-left, home-middle, and home-right content code is placed within the "inner" <div> which is placed below the <div> that is created for the welcome/slider.
September 26, 2013 at 11:37 pm #64430scaughtMemberHello? Bueller?
September 26, 2013 at 11:54 pm #64432Brad DaltonParticipantHere's what i used. You can simply change the hooks for each function:
<?php add_action( 'genesis_meta', 'agency_home_genesis_meta' ); /** * Add widget support for homepage. If no widgets active, display the default loop. * */ function agency_home_genesis_meta() { if ( is_active_sidebar( 'home-slider' ) || is_active_sidebar( 'home-welcome' ) || is_active_sidebar( 'home-left' ) || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-right' ) ) { remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_before_content_sidebar_wrap', 'agency_home_loop_helper', 5 ); add_action( 'genesis_loop', 'agency_home_welcome_helper', 15 ); add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); add_filter( 'body_class', 'add_body_class' ); function add_body_class( $classes ) { $classes[] = 'agency'; return $classes; } } } function agency_home_loop_helper() { if ( is_active_sidebar( 'home-left' ) || is_active_sidebar( 'home-middle' ) || is_active_sidebar( 'home-right' ) ) { echo '<div id="home">'; echo '<div class="home-left">'; dynamic_sidebar( 'home-left' ); echo '</div><!-- end .home-left -->'; echo '<div class="home-middle">'; dynamic_sidebar( 'home-middle' ); echo '</div><!-- end .home-middle -->'; echo '<div class="home-right">'; dynamic_sidebar( 'home-right' ); echo '</div><!-- end .home-right -->'; echo '</div><!-- end #home -->'; } } function agency_home_welcome_helper() { if ( is_active_sidebar( 'home-slider' ) ) { echo '<div id="home-slider">'; dynamic_sidebar( 'home-slider' ); echo '</div><!-- end #home-slider -->'; } if ( is_active_sidebar( 'home-welcome' ) ) { echo '<div id="home-welcome">'; dynamic_sidebar( 'home-welcome' ); echo '</div><!-- end #home-welcome -->'; } } genesis();
These are the 2 i changed:
genesis_before_content_sidebar_wrap genesis_loop
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.