Inserting a new Widget Area

Community Forums Forums Design Tips and Tricks Inserting a new Widget Area

This topic is: resolved

Tagged: ,

This topic contains 4 replies, has 2 voices, and was last updated by  Sumu 1 year, 6 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #21092

    Sumu
    Participant
    Post count: 39

    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!

     

     

    #21097

    braddalton
    Participant
    Post count: 9199

    You 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:
    [php]
    /** 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’ ),
    ) );
    [/php]

    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.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #21101

    Sumu
    Participant
    Post count: 39

    Hi 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!

     

     

     

    #21197

    braddalton
    Participant
    Post count: 9199

    The 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.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #21433

    Sumu
    Participant
    Post count: 39

    Thanks Brad,

    restarted fresh according to the tutorial. It works now.

    Thanks again!

     

     

     

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.