Community Forums › Forums › Design Tips and Tricks › Inserting a new Widget Area
This topic contains 4 replies, has 2 voices, and was last updated by Sumu 2 months, 4 weeks ago.
-
AuthorPosts
-
February 18, 2013 at 2:49 pm #21092
Hello,
I apologize if this has been covered before in similar ways – but I still do not get how to implement a widget area in a new div that I managed to place inside an area that I created inside my theme.
Here are the steps that I have taken (not utilizing the Simple Hooks plugin):
I need a container just above the content area, next to the sidebar – did that by creating a top-content-bar.php with the related div inside.Added to the functions.php:
// Top content Bar
add_action(‘genesis_before_content’, ‘include_top_content_bar’);
function include_top_content_bar() {
require(CHILD_DIR.’/top-content-bar.php’);
}So far so good.
Now the (for me) difficult part:
How do I make this container usable for a widget, or even the submenu?
Thanks!
February 18, 2013 at 3:14 pm #21097You could have registered a widget area and hooked it in using the genesis_before_content hook.
You only missed registering the widget.
Here’s some sample code you can modify:
/** Register widget area */ genesis_register_sidebar( array( 'id' => 'top-content-bar', 'name' => __( 'Top Content Bar', 'child' ), 'description' => __( 'This is the Top Content Bar section.', 'child' ), ) );
Here’s a good tutorial you may want to test using the conditional tag you want and the genesis hook.
http://designsbynickthegeek.com/tutorials/add-widgeted-sidebar
Then you can drag in the custom menu widget.
WordPress Developer & Consultant
Brad Dalton @ WP Sites – Click Here to Get Genesis Child Theme Tips Delivered.February 18, 2013 at 3:44 pm #21101Hi Brad,
thanks for posting, but it does not work – the area shows up in the control pane, widget is saved in it, but a now-show in the area.
I am trying to understand what the id relates to – it does not seem to be the div in which I want the widget to be in. In my
top-content-bar.php there is the following code:<code><?php?><div id=”top-content”>
</div>
<?php?>
</code>Thanks for your help!
February 18, 2013 at 10:31 pm #21197The way you have setup the widget is not the normal way it is done.
I suggest you follow the link to the tutorial and test it on a test site first.
The code above is sample code but you need to follow Nicks tutorial to get it working.
WordPress Developer & Consultant
Brad Dalton @ WP Sites – Click Here to Get Genesis Child Theme Tips Delivered.February 19, 2013 at 2:08 pm #21433Thanks Brad,
restarted fresh according to the tutorial. It works now.
Thanks again!
-
AuthorPosts
You must be logged in to reply to this topic.