Community Forums › Forums › Archived Forums › Design Tips and Tricks › Rearranging home page widgets
Tagged: home page, streamline pro, widget
- This topic has 6 replies, 2 voices, and was last updated 10 years, 3 months ago by mbeck.
-
AuthorPosts
-
June 21, 2014 at 10:09 am #110955mbeckParticipant
I'm using the Streamline Pro theme and need some help arranging things.
I've successfully moved the 3 home-featured widgets below the content and also added a new widget to the page.
Right now, the order is [Content][New Widget][Home-Featured].
I would like it to be [Content][Home-Featured][New Widget].I suspect it's fairly simple. Just don't know how to do it.
June 21, 2014 at 6:53 pm #111000nutsandboltsMemberThe Home Featured area needs to be called first in your template - you should be able to simply move the function for the new widget area below the one for home featured. Whatever order is used in the template will determine how they display on the page (assuming they use the same hook).
Alternately, you could call your new widget area using a different hook to force it to display lower on the page.
If you can paste in your front-page.php I'd be glad to take a look. 🙂
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+June 21, 2014 at 7:38 pm #111009mbeckParticipantThanks for the offer to take a look at this, Andrea.
Here is the code from the front-page.php file:<?php
/**
* This file adds the Home Page to the Streamline Pro Theme.
*
* @author StudioPress
* @package Streamline Pro
* @subpackage Customizations
*/add_action( 'genesis_meta', 'streamline_home_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function streamline_home_genesis_meta() {if ( is_active_sidebar( 'home-featured-1' ) || is_active_sidebar( 'home-featured-2' ) || is_active_sidebar( 'home-featured-3' ) ) {
//* Force content-sidebar layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );// Add streamline-pro-home body class
add_filter( 'body_class', 'streamline_body_class' );// Add homepage widgets
add_action( 'genesis_after_content_sidebar_wrap', 'streamline_homepage_widgets' );}
}function streamline_body_class( $classes ) {
$classes[] = 'streamline-pro-home';
return $classes;}
function streamline_homepage_widgets() {
if ( is_active_sidebar( 'home-featured-1' ) || is_active_sidebar( 'home-featured-2' ) || is_active_sidebar( 'home-featured-3' ) ) {
echo '<div class="home-featured">';
genesis_widget_area( 'home-featured-1', array(
'before' => '<div class="home-featured-1 widget-area">',
'after' => '</div>',
) );genesis_widget_area( 'home-featured-2', array(
'before' => '<div class="home-featured-2 widget-area">',
'after' => '</div>',
) );genesis_widget_area( 'home-featured-3', array(
'before' => '<div class="home-featured-3 widget-area">',
'after' => '</div>',
) );echo '</div><!-- end #home-featured -->';
}
}
add_action( 'genesis_after_content', 'mbi_after_widget_widget');
function mbi_after_widget_widget() {
if ( is_active_sidebar( 'after-widget-widget' ) ) {
genesis_widget_area( 'after-widget-widget', array(
'before' => '<div id="page-title">',
'after' => '</div>',
) );
}
}genesis();
And here is the link to the home page:
http://www.michaeljbeck.com/June 21, 2014 at 7:52 pm #111012nutsandboltsMemberThanks for that.
So your Home Featured section is using the genesis_after_content_sidebar_wrap hook, and your new widget area is using genesis_after_content. That's why the new area is displaying first - see the visual hook guide here: http://genesistutorials.com/visual-hook-guide/
If you change the hook for your new widget area to genesis_after_content_sidebar_wrap, it should pull them in the order they're called in the template.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+June 21, 2014 at 9:17 pm #111017mbeckParticipantHi Andrea,
I changed the coding at the end of the file to what's below, but nothing changed.
Any thoughts?add_action( 'genesis_after_content_sidebar_wrap', 'mbi_after_widget_widget');
function mbi_after_widget_widget() {
if ( is_active_sidebar( 'after-widget-widget' ) ) {
genesis_widget_area( 'after-widget-widget', array(
'before' => '<div id="page-title"><div class="wrap">',
'after' => '</div></div>',
) );
}
}genesis();
June 21, 2014 at 10:00 pm #111019nutsandboltsMemberHmm, I guess it doesn't want to cooperate. That's always fun! Try changing the hook for the home featured widgets (way up toward the top) to genesis_after_content to see if that moves them up.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+June 21, 2014 at 10:23 pm #111020mbeckParticipantThanks for the ideas, Andrea.
None seem to work.
In fact, if I eliminate the new widget and simply change the home-featured widget area to 'genesis_after_content_sidebar_wrap', the home widgets disappear altogether.Guess I'll just go back to the original layout without the new widget.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.