Community Forums › Forums › Archived Forums › Design Tips and Tricks › Action Hook Not Showing
Tagged: action hooks, adding widget, outreach, Outreach Pro
- This topic has 6 replies, 2 voices, and was last updated 7 years, 10 months ago by
kathyosborne.
-
AuthorPosts
-
May 19, 2017 at 11:20 am #206708
kathyosborne
ParticipantI'm working in the Outreach theme. I need to add two more widgets to the home page.
Below the slider you can see the four widget sections showing. I need a widget above and below it. The one below it is showing, but the one above isn't.
I used the same code and just changed the hook...
This is the code I'm using for the Specials area that *is* working
//Add Specials Area function genesischild_specials() { genesis_register_sidebar( array( 'id' => 'specials', 'name' => __( 'Specials Section', 'genesis' ), 'description' => __( 'This is for the specials section on home page', 'genesis' ), ) ); } add_action ('widgets_init','genesischild_specials'); //Position Specials Area function genesischild_specials_position () { echo '<div class="specials-container"><div class="wrap">'; genesis_widget_area ('specials'); echo '</div></div>'; } add_action ('genesis_after_home-bottom_widget_area','genesischild_specials_position');
Here is the code that *is not* working
//Add Description Widget Area function genesischild_description() { genesis_register_sidebar( array( 'id' => 'description', 'name' => __( 'Description Section', 'genesis' ), 'description' => __( 'This is for the description section on home page', 'genesis' ), ) ); } add_action ('widgets_init','genesischild_description'); //Position Description Widget Area function genesischild_description_position () { echo '<div class="description-container"><div class="wrap">'; genesis_widget_area ('description'); echo '</div></div>'; } add_action ('genesis_before_home-bottom_widget_area','genesischild_description', 5);
Not sure what I'm doing wrong.... ???
http://wordpress.sprfc.com/May 19, 2017 at 11:54 am #206712kathyosborne
ParticipantIn addition, how can I make these areas 100% in width> not the 4 columns... ?
May 19, 2017 at 4:47 pm #206715Victor Font
ModeratorIt's most likely due to the priority of 5 you gave the code that's not working. Your specials area is not really placing the specials area after the home-bottom widget area. It's placing it within the home-bottom widget area. I wouldn't have used the add actions to place the widget areas either. I would have just modified front-page.php directly which is probably using the default priority of 10 to create home-bottom.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?May 20, 2017 at 6:12 am #206738Victor Font
ModeratorAs I was thinking more on this, where did you find the action hooks you are using documented? These hooks are not found in Genesis, nor are they dynamically generated by any of the genesis dynamic functions. Every add_action requires a corresponding do_action. You can always create your own hooks, but where did you include the do_actions for your hooks?
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?May 22, 2017 at 5:42 am #206827kathyosborne
ParticipantHi Victor!
When I was trying to figure out why, I took a look at the home page and didn't really see a clear way for me to do it. I'm still early in the hook/action learning process so I didn't want to break anything.
I was using the Genesis Visual Hook Guide plugin and to add it in along with this tutorial as a guide: https://wpbeaches.com/add-full-width-row-footer-widgets-genesis-child-theme/
The 5 was just an attempt to get it to show, but it didn't work with or without it.
I'm still new to action hooks so what I'm doing might not make sense :0
Is there a good resource for me to learn about editing the front-page.php?
thanks so much,
kathyMay 22, 2017 at 6:01 am #206828Victor Font
ModeratorFirst, get rid of all the code you added. In Outreach Pro, at the bottom of front-page.php, you'll find this function:
function outreach_home_bottom_widgets() { genesis_widget_area( 'home-bottom', array( 'before' => '<div class="home-bottom widget-area"><div class="wrap">', 'after' => '</div></div>', ) ); }
Modify this function as so:
function outreach_home_bottom_widgets() { genesis_widget_area( 'before-home-bottom', array( 'before' => '<div class="before-home-bottom widget-area"><div class="wrap">', 'after' => '</div></div>', ) ); genesis_widget_area( 'home-bottom', array( 'before' => '<div class="home-bottom widget-area"><div class="wrap">', 'after' => '</div></div>', ) ); genesis_widget_area( 'after-home-bottom', array( 'before' => '<div class="after-home-bottom widget-area"><div class="wrap">', 'after' => '</div></div>', ) ); }
In functions.php, you add:
genesis_register_sidebar( array( 'id' => 'before-home-bottom', 'name' => __( 'Before Home Bottom', 'outreach' ), 'description' => __( 'This is the before home bottom widget area.', 'outreach' ), ) ); genesis_register_sidebar( array( 'id' => 'after-home-bottom', 'name' => __( 'After Home Bottom', 'outreach' ), 'description' => __( 'This is the after home bottom widget area.', 'outreach' ), ) );
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?May 23, 2017 at 3:30 am #206854kathyosborne
ParticipantWorked perfect! Thank you so much of your help.
Kathy -
AuthorPosts
- The topic ‘Action Hook Not Showing’ is closed to new replies.