ThemeShaper Forums » Thematic

Adding extra wrapping div to the header

(5 posts)
  • Started 12 years ago by iamthewebguy
  • Latest reply from iamthewebguy
  • This topic is resolved

Tags:

  1. iamthewebguy
    Member

    Hello,

    I looked around the forum for an answer and although there were some topics that are close.. I didn't find the answer to my question.

    What I am trying to do should be simple:

    I want to wrap everything inside the header EXCEPT for the access in a new div.

    So start the new wrapping div before branding and end before access.

    The Reason:

    I want to keep the headers original size but be able to position the branding (float left) and a new header widget area (float right). The only way I can do that now is if I restrict the header size.

    I'm guessing this can all be done through the functions.php in my child theme.. I'm just not familiar enough with the hooks and php code to do it.

    Thanks!

    BTW: I'm using this code (from this forum) to add the header widget area (works great):

    // adding the widget area to your child theme
    function my_header_widgets() {
    if ( function_exists('dynamic_sidebar') && is_sidebar_active('header-aside') ) {
    echo '<div id="header-aside" class="aside">'. "\n" . '<ul class="xoxo">' . "\n";
    dynamic_sidebar('header-aside');
    echo '' . "\n" . '</div><!-- #header-aside .aside -->'. "\n";
    }
    }
    add_action('thematic_header', 'my_header_widgets', 8);
    ?>

    Posted 12 years ago #
  2. amygail
    Member

    I do this by inserting my widget area into the branding div and adjusting the css

    This may be a better method though....

    http://forums.themeshaper.com/topic/access-branding-038-header-widget-positioning

    Also - Chris is working on a new simpler method to add new widget areas - he's mentioned that this will be ready by Friday. I'd keep an eye out for that.

    Posted 12 years ago #
  3. iamthewebguy
    Member

    Thanks for the information Amy. The solution on the other page seems quite confusing (probably just me not understanding it).

    I wonder if my problem could be solved by writing a function that inserts a div before branding and ends the div before access.. thereby creating a new div for me to work with without messing with the header at all.

    How did you insert the widget area into the branding div?

    Posted 12 years ago #
  4. amygail
    Member

    Actually, I hooked into "themeatic_header".... but....

    You can pretty much cut and paste that code (in the link) into your functions.php
    (you probably don't need the first part, just copy what you need.

    I can't recommend this series enough...

    http://themeshaper.com/modify-wordpress-themes/

    In your case, esp this....

    http://themeshaper.com/action-hooks-wordpress-child-themes/

    If you're not in a rush, I'd wait until Chris is back with his new 'one line' solution (he said on Friday)

    Oh, and a search in this forum for "insert the widget area into the branding div" will give you more clues

    Posted 12 years ago #
  5. iamthewebguy
    Member

    Amy, Thanks for the last link in your last reply.. that got me there. I figured out how to insert the extra div that I needed by creating the following code:

    // Begin header inner wrapping open div
    function start_header_inner() { ?>

    <!-- header inner wrap starts here -->
    <div id="header-inner-wrap">

    <?php } // end of our new function start_header_inner

    // Add starting div to header before branding
    add_action('thematic_header','start_header_inner', 1);

    // Begin header inner wrapping closing div
    function end_header_inner() { ?>

    </div>
    <!-- header inner wrap ends here -->

    <?php } // end of our new function end_header_inner

    // Add closing div to header after header widget area
    add_action('thematic_header','end_header_inner', 9);

    Posted 12 years ago #

RSS feed for this topic

Reply

You must log in to post.