Link to home
Start Free TrialLog in
Avatar of Spencer K
Spencer K

asked on

Reorder Wordpress Widgets using Action Hooks.

Hello, I  have a Wordpress theme, on this theme I would like to reorder the some front page Widgets.  For a visual representation of the Widgets please see Webpage.jpg.  I would like to swap A with B.

The code below shows my home-template.php (I have also attached this page).

I have numbered the Hooks from 1 - 6.  I would like to reorder number 4 with number 6.   I can reorder all of the Hooks using priority, apart from number 4 (why is this?).
* Template Name: Home Page
*/
do_action( 'genesis_home' );
//* Force full-width-content layout setting
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );

**// Execute Home Top - Slider image  1**

add_action( 'genesis_after_header', 'wsm_home_top');
function wsm_home_top() {
	genesis_widget_area( 'slider', array( 'before' => '<div class="home-slider widget-area">', 'after' => '</div>') );
}

**// Execute Home Top - Additional News Banner 2**

add_action( 'genesis_after_header', 'wsm_home_featured', 15 );
function wsm_home_featured() {
	genesis_widget_area( 'home-top-featured', array( 'before' => '<div class="home-top-featured widget-area"><div class="wrap">', 'after' => '</div></div>') );
}

**// Remove the standard loop 3**
remove_action( 'genesis_loop', 'genesis_do_loop' );

**// Execute Home Mid Section - Three layer widget section 4**

add_action( 'genesis_loop', 'wsm_home_loop_helper' );
function wsm_home_loop_helper() {
	echo'<div class="home-mid widget-area">';
	genesis_widget_area( 'home-mid-left', array( 'before' => '<div class="mid-left widget-area">', 'after' => '</div>') );
	genesis_widget_area( 'home-mid-center', array( 'before' => '<div class="mid-center widget-area">', 'after' => '</div>') );
	genesis_widget_area( 'home-mid-right', array( 'before' => '<div class="mid-right  widget-area">', 'after' => '</div>') );
	echo'</div >';
}

**// Execute Home Bottom - Contact banner 5**

add_action( 'genesis_before_footer', 'caroline_home_bottom_cta', 5 );
function caroline_home_bottom_cta() {
genesis_widget_area( 'home-mid-cta', array( 'before' => '<div class="home-mid-cta widget-area"><div class="wrap">', 'after' => '</div></div>') );
}

**// Execute Home Bottom Section - Four post layer 6**

add_action( 'genesis_before_footer', 'caroline_home_bottom', 8 );
function caroline_home_bottom() {
	genesis_widget_area( 'home-bottom', array( 'before' => '<div class="home-bottom widget-area"><div class="wrap">', 'after' => '</div></div>') );
}
genesis();

Open in new window


Thanks for your assistance.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.