ThemeShaper Forums » Thematic

[closed]

widgets in the header

(77 posts)
  • Started 5 years ago by kingsinger
  • Latest reply from mrmikeman
  • This topic is resolved
  1. kga
    Member

    I added your code to my test child theme and everything works no errors and no white page. The search is in the main nav the header aside is there and I can put a widget in it and the widget appears where it should( lacking styling ). I'm not sure what to tell you as everything seems to be working properly for me with the code you posted.

    I'm not getting the white screen ALL of the time though. Most of my pages work, but some give me the white screen. Not all.

    So in your testing, you may have that issue, but just haven't found the white screen-sensitive link, etc. (and that link is totally random - its just another page - even sometimes it works, then I go back and get the white screen.

    Thanks for all the help - totally appreciated.

    Posted 4 years ago #
  2. I added your code from your functions.php into my test child theme and everything works no errors and only one access div.

    The search is in the main nav the header aside is there and I can put a widget in it and the widget appears where it should( lacking styling ). I'm not sure what to tell you as everything seems to be working properly for me with the code you posted.

    -Gene

    Posted 4 years ago #
  3. kga
    Member

    and only one access div.

    Well yeah you're not going to get two #access divs - I left that section of code out that Chris suggested adding in - you'll see what I mean if you backtrack a little.

    Posted 4 years ago #
  4. I cant speak for Chris's original intentions. Also it can be problematic interpreting and combining solutions between threads. Where we are now It seems that you have a working solution at least a working beginning to a solution.

    What do you want differently from the block of code that I tested from your functions.php?

    Posted 4 years ago #
  5. kga
    Member

    Well, nothing Gene and actually I think I figured it out - I'll let you know in a minute. This sounds odd, but I have links I hard-coded into the body and when using the / at the end, its giving me the white screen.

    Example:

    Works fine - this is from the built-in menus.
    /moto/flexx/bends

    But in the body hard-coded the links as:
    /moto/flexx/bends/

    The ending / I believe is causing the white screen.

    I never would have guessed that.

    Posted 4 years ago #
  6. kga
    Member

    That WAS the problem....but there's more.....

    Posted 4 years ago #
  7. kga
    Member

    UPDATE - WRONG.

    My finding of the ending slash was an issue, but now I can't access the Admin - when I try to access /wp-admin/ I get the white screen.

    If I remove the funtions.php down to the way I had it before, it was fine (before being just the addition to the search function in #access).

    this stuff is so annoying.

    Posted 4 years ago #
  8. kga
    Member

    Now its fine again....I'm going to run an error test with MAMP and check it that way.

    Otherwise, I think I'll just move onto another project for a while - this is driving me crazy.

    Posted 4 years ago #
  9. Hello all I am a noob when it comes to this stuff. I have only been working in WP for a little over a week now. I am running WP 2.9.2 and have Acamas 1.0.2 activated. I've been using the Themeshaper forums to make small fixes and modifications. I want to add a header search widget to the top right hand side of the page aligned with the top of my logo. I have read all three pages of this post and think I understand 1) I need to add code from Chris to my functions.php file. 2) I then need to add code to move or fine tune the header widget into place?

    I guess where I get lost is I don't know exactly where in my functions.php or styles.css file to add the code. Any help would be great.

    I am placing a link to my site below so you can check my current status.

    www.lancedevenson.com

    Posted 4 years ago #
  10. I just realized all the changes I wanted to make to Acamas have already been incorporated in the Feature theme. I will switch and customize that one so please disregard my last post.

    Thank you Ian for the vision and diversity you put in all your child themes.

    Posted 4 years ago #
  11. Sorry to drag up an old thread but can someone enlighten me...

    I'd like my #header-aside DIV to be BEFORE my #branding DIV (as I'm going for a full length banner across the top of my site). How do I do this?

    More specifically, what do I need to change in Chris's code to swap up the order. Spent a few hours banging my head against the table - someone please point me to the light!

    Thanks - Ben

    Posted 3 years ago #
  12. Aha - managed to suss it. This hook thing is pretty impressive. Any future readers who need the answer...

    To create this widget area (#header-aside) as the first div within #header and therefore above the logo area etc

    Just amend the code Chris used on the first page of the thread and change the hook number from '8' to '1' - Amazing stuff. Thanks for this great resource people - I'm learning loads!

    // This will create your widget area
    function my_widgets_init() {
    register_sidebar(array(
    'name' => 'Header Aside',
    'id' => 'header-aside',
    'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
    'after_widget' => "",
    'before_title' => "<h3 class=\"widgettitle\">",
    'after_title' => "</h3>\n",
    ));

    }
    add_action( 'init', 'my_widgets_init' );

    // 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 3 years ago #
  13. One more point - didn't spot the post by cannobbio. Anyone finding this post in the future - make sure you paste the code from his post otherwise you will suffer validation errors as the first post is missing the code to make closing and tags. Here is the working code again:

    // This will create your widget area
    function my_widgets_init() {
        register_sidebar(array(
           	'name' => 'Header Aside',
           	'id' => 'header-aside',
           	'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
           	'after_widget' => "</li>\n",
    		'before_title' => "<h3 class=\"widgettitle\">",
    		'after_title' => "</h3>\n",
        ));
    
    }
    add_action( 'init', 'my_widgets_init' );
    
    // 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" . '</ul>'. "\n";
        echo '' . "\n" . '</div><!-- #header-aside .aside -->'. "\n";
    }
    }
    add_action('thematic_header', 'my_header_widgets', 8);
    Posted 3 years ago #
  14. louisJ
    Member

    Hi

    I am a noob, I added Chris' code in my child theme functions.php but I don't see the new area for the header widget with firebug...no header-aside appears in the code.

    Can somebody help me please?

    By the way there are a lot of 'init' functions in the wordpress directory, which one of those is hooked here?

    Thanks

    Posted 3 years ago #
  15. louisJ
    Member

    The code here works better for me!
    http://forums.themeshaper.com/topic/something-new-bout-widgetized-areas#post-6660

    Posted 3 years ago #
  16. alex456
    Member

    kingsinger, you need to try out Total Widget Control. I think it will make working on widget placement a lot easier for you.

    Posted 3 years ago #
  17. mrmikeman
    Member

    im trying to do this same thing now and i add the code above and i get a syntax error on

    function my_header_widgets() {

    that line ^

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.