ThemeShaper Forums » Thematic

[closed]

header widget

(23 posts)
  • Started 4 years ago by blueblue
  • Latest reply from fwunder
  • This topic is not resolved
  1. blueblue
    Member

    hi guys, im trying to add a header widget to my site, i have successfully added it but i want it to be located in the topmost right portion of the header, so i can add social media icons like fb, twitter , rss feed and a email icon. ( i wrote a .dot to indicate the position of the header widget )

    is there any way to move the header aside widget before branding? or maybe theres another method in css ?

    i also noticed that the navbar moves 1px below, creating a white line in the header , how do I resolve this ?

    hope someone can help

    www.blue2x.com

    Posted 4 years ago #
  2. Wow, really nice customization.

    What does your current code look like?

    You could try hooking it in at: thematic_aboveheader();

    e.g:

    function show_new_widget_area(){
        dynamic_sidebar('header-widgets');
    }
    add_action('thematic_aboveheader','show_new_widget_area');
    Posted 4 years ago #
  3. blueblue
    Member

    body {
    	background-color: #0B4C58;
    font-family:Verdana,sans-serif;
    }
    
    #wrapper {
    background:url("images/abs.jpg") no-repeat scroll center top ;
    }
    
    #header {
    background-image: url(images/hd.jpg) ;
    background-repeat:no-repeat;
    background-position:center top;
    
    height:119px;
    
    }
    
    #header-aside {
      float: right;
      width: 150px;
    }
    
    #branding {
    padding:37px 0px 0px 42px;
    
    width: 940px;
    }
    
    #blog-title a {
    display:block; /* We do this so we can add a background image */
    text-indent:-9000px; /* Hides the text--but not from search engines */
    background:url(images/log.png) no-repeat ; /* adds in the logo image */
    padding:0px 0 0 0;
    
    }
    
    #blog-description {
    position:absolute;
    left:-9000px; /* We avoid display:none because it's bad for SEO */
    }
    
    #access {
    border-bottom:none;
    font-size:12px;
    height:65px;
    z-index:1;
    padding-top:35px;
    
    }
    
    #main {
    background-color:#E8E8E8;
    }
    
    #container {
    background-color:#FFFFFF;
    padding-top:28px;
    width: 682px;
    
    }
    
    #content {
    margin-left:30px;
    width:622px;
    
    }
    
    h1.entry-title {
    background-color:#FFFFFF;
    color:black;
    }
    
    .entry-title {
    
    font-size: 22px;
    }
    
    .entry-title a:active, .entry-title a:hover {
    color:#CCCCCC;
    
    }
    
    .entry-meta {
    font-size: 10px ;
    font-style: normal ;
    
    }
    
    .entry-content {
    
    font-size: 12px;
    
    }
    
    .entry-utility {
    
    font-size : 11px ;
    
    }
    
    h1.page-title {
    background-color:#FFFFFF;
    color:black;
    }
    
    .aside ul ul {
    list-style:none;
    }
    
    /* superfish menu  --------------------------- ----------   */
    
    .sf-menu  {
     background-color: #000000;
    border:none;
    width:940px;
    height:40px;
    
    padding-top: 5px
    
    }
    
    .sf-menu a{
    color: white; /*Sets top level font color*/
    background-color: #000000;
    border: none;
    }
    
    .sf-menu li:hover, .sf-menu li.sfHover, .sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
    
    background-color: #000000;
    color: white;
    border-bottom-color:none;
    }
    
    .sf-menu li:hover, .sf-menu li.sfHover,
    .sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active, .sf-menu a:visited {
    background-color: #000000;
    color: white;
    border-bottom-color:none;
    }
    
    .sf-menu li {
    background-color: #000000;
    }
    
    /* superfish menu -------------------------------------------   */
    
    #respond {
    
    background: transparent;
    }
    
    /*sidebar coding begins here ---------------------------------------*/
    
    .main-aside {
    width:230px;
    
    }
    
    .main-aside h3 {color:#fff;
    
    }
    .aside ul ul li {color:#C1DDED;}
    
    #primary {
        border:0px solid #000000;
        padding:25px 0 0 0;
        margin-bottom:22px;
    }
    
    #primary a{
    color:#858585;
    }
    
    #secondary a{
    color:#858585;
    }
    
    .aside ul ul li {
    color:#858585;
    }
    
    .aside h3 {
    font-size:14px;
    font-style:normal;
    background:url(images/cat.jpg) no-repeat ;
    padding-left:10px;
    
    }
    
    .aside , .aside input {
    
    line-height:20px;
    font-size : 11px;
    
    }
    
    /*sidebar coding ends here ---------------------------------------*/
    
    /* add a border to separate posts */
    div.post{
    border-bottom:1px dashed #00364A;
    }
    
    /* too much space between end of post and the border caused by the div.entry-utility margin: we clear the margin*/
    div.entry-utility{
    margin-bottom:0;
    }
    /* we add some top margin to .entry-title to separate them from the above borders*/
    .entry-title{
    margin-top:22px;
    }
    
    /* remove the border on sigle post pages */
    body.single div.post{
    border-bottom:none;
    }
    
    #comments-list li.bypostauthor {
    
    background :#EEE;
    
    }
    
    /*footer coding starts  here ---------------------------------------*/
    
    #footer {
    
    margin-top:0px; /* remove the default top margin on footer */
    border-top: transparent;
    }
    
    #subsidiary {
    background-color : #000000;
    padding: 25px 0px 0px;
    }
    
    #subsidiary .aside h3 {
    background:none;
    padding-left:20px;
    }
    
    #subsidiary .aside {
    color : #FFFFFF ;
    padding-left : 5px ;
    width:280px;
    }
    
    #subsidiary .aside a, #subsidiary .aside a:active {
    color : #E0E0E0 ;
    
    }
    
    #siteinfo {
    background-color : #000000;
       color: #EEE;
        font-size:11px;
        line-height:18px;
        padding:22px 0 24px 0;
    
    }
    #siteinfo a {
     color: #FFFFFF;
      text-decoration: none;
    }
    #siteinfo a:active,
    
    #siteinfo a:hover {
        color: #FFFFFF;
    }
    Posted 4 years ago #
  4. blueblue
    Member

    i tried the code but it puts it above the header image? ill post an image on what i want >

    http://img715.imageshack.us/img715/9825/prevl.jpg

    Posted 4 years ago #
  5. blueblue
    Member

    managed to fix this, i changed the width of brander, floated it right, then added clear:both to access and its fixed =) wohoo. now for the search bar in the navbar, next step.

    Posted 4 years ago #
  6. is there anyway to have the widget area on top of the header background image.

    I've done something similar to yourself however the wideget appears behind the header background image I would like it to appear over the top of the back ground image

    Posted 4 years ago #
  7. blueblue
    Member

    so sorry i forgot about different browser resolutions , when i try 1152 x 864 , 1280 x 800, the branding ( logo ) moves away from the layout to the left, while the social media icons moves to the right away from the layout too. can any1 help

    Posted 4 years ago #
  8. Thinkink
    Member

    Have you tried giving the #header a css of:
    width: 940px;
    margin: 0 auto;

    It seems to work put the logo and social icons in the right place, in Safari

    Posted 3 years ago #
  9. blueblue
    Member

    thanks think, that fixed it. next is tweaking the navbar =)

    Posted 3 years ago #
  10. Hi bleublue and Devin,

    I want to do exactly the same thing.

    @Devin
    Where to do put the code you write?
    function show_new_widget_area(){
    dynamic_sidebar('header-widgets');
    }
    add_action('thematic_aboveheader','show_new_widget_area');

    @bleubleu
    Can you please write the steps you've done to make this?

    Thanks!

    Posted 3 years ago #
  11. I resolved the problem...

    Posted 3 years ago #
  12. Iceman
    Member

    Well, i didn't solved yet... =(
    If somebody can help me, i'll appreciate!
    I put the code on functions.php and the style in my style.css:
    #header-aside{
    height:70px;
    background:#00FF66; /* just to test... */
    float:right
    }
    But... nothing happens... Am i forgetting something?

    Posted 3 years ago #
  13. @iceman- you need to 1. register the widget, 2. tell it where to display and 3. make sure you have a widget in the widget area.

    you can do this one of 2 ways

    if (function_exists('register_sidebar')) {
    	register_sidebar(array(
    		'name'=> 'Header Aside',
    		'id' => 'header-aside',
    		'description' => 'This is where your header widgets go',
    		'before_widget' => '<li id="%1$s" class="widget %2$s">',
    		'after_widget' => '</li>',
    		'before_title' => '<h3 class="widgettitle">',
    		'after_title' => '</h2>',
    	));
    }
    
    function show_new_widget_area(){
        if (function_exists('dynamic_sidebar')){
    		dynamic_sidebar('header-aside');
    	}
    }
    add_action('thematic_aboveheader','show_new_widget_area');

    or

    function child_widgetized_areas($content) {
            $content['Header Aside'] = array(
    			'admin_menu_order' => 100,
    			'args' => array (
    				'name' => 'Header Aside',
    				'id' => 'header-aside',
                    'description' => __('The header widget area.', 'thematic'),
    				'before_widget' => thematic_before_widget(),
    				'after_widget' => thematic_after_widget(),
    				'before_title' => thematic_before_title(),
    				'after_title' => thematic_after_title(),
    				),
    			'action_hook'	=> 'thematic_aboveheader',
    			'function'		=> 'thematic_header_aside',
    			'priority'		=> 10,
    			);
    
                  return $content;
    }
    
    add_filter('thematic_widgetized_areas', 'child_widgetized_areas');
    
    // Define the Header Aside
    function thematic_header_aside() {
    	if (is_active_sidebar('header-aside')) {
    		echo thematic_before_widget_area('header-aside');
    		dynamic_sidebar('header-aside');
    		echo thematic_after_widget_area('header-aside');
    	}
    }

    each method creates a widget area with the ID of header-aside and adds it to the hook, thematic_aboveheader.

    Posted 3 years ago #
  14. Iceman
    Member

    I've found a solution yet, although it's not the best way... I'm using Ian's code to turn blog title into a linked banner; none solution from several threads here worked fine... The only way to do this was using display:none (what is unrecommended because of SEO). My steps:

    Using before:

    #header {
    z-index:2;
    background:url(library/images/myheaderback.png) no-repeat center top
    }

    #blog-title a {
    color:#000;
    text-decoration:none;
    /* to hide */
    display:block;
    text-indent:-9000px;
    height: 240px;
    width: 560px;
    }

    and

    #blog-description {
    color:#666;
    font-size:13px;
    font-style:italic;
    /* to hide */
    position:absolute;
    left:-9000px;
    }

    But when i use any code to put a widget area at header it pulls the banner down, creating a blank area. The only solution was change to:

    #blog-title a {
    display:none;
    }

    The code in functions.php is this:

    // 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";
    echo "\n" . '</div><!-- #header-box -->'. "\n";
    }
    }
    add_action('thematic_header', 'my_header_widgets',2);

    function remove_branding() {
    remove_action('thematic_header','thematic_brandingopen',1);
    }
    add_action('init', 'remove_branding');

    function my_brandingopen() { ?>
    <div id="header_box">
    <div id="branding">
    <?php }
    add_action('thematic_header','my_brandingopen',1);

    Posted 3 years ago #
  15. Iceman
    Member

    Thank you very much, helga, i've found a solution yet, although it's not the best way... I'm using Ian's code to turn blog title into a linked banner; none solution from several threads here worked fine...

    The only way to do this was using display:none(what is unrecommended because of SEO, i know...). My steps:

    Using before, to show my linked banner:

    #header {
    z-index:2;
    background:url(library/images/myheaderback.png) no-repeat center top
    }

    #blog-title a {
    height: 240px;
    width: 560px;
    /* to hide */
    display:block;
    text-indent:-9000px;
    }

    and

    #blog-description {
    /* hide */
    position:absolute;
    left:-9000px;
    }

    But when i use any code to put a widget area at header it pulls the banner down, creating a blank area. I tried several ways in my css to correct the position, but i don't get it. The only solution was change to:

    #blog-title a {
    display:none;
    }

    Of course, this turn off my clickable banner, but at least my widget area still where i want it to be =(
    The widget area style was:

    /* header widgets area*/
    #header-aside{
    width:180px;
    height:80px;
    float:right;
    z-index:3;
    }

    The code in functions.php is this:

    // 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";
    echo "\n" . '</div><!-- #header-box -->'. "\n";
    }
    }
    add_action('thematic_header', 'my_header_widgets',2);

    function remove_branding() {
    remove_action('thematic_header','thematic_brandingopen',1);
    }
    add_action('init', 'remove_branding');

    function my_brandingopen() { ?>
    <div id="header_box">
    <div id="branding">
    <?php }
    add_action('thematic_header','my_brandingopen',1);

    Does helga's way works when using the css tricks to hide blog title, like negative text-indent?

    Posted 3 years ago #
  16. shelleyeaster
    Member

    Sorry to hop on to this old thread, but I've been trying to register a new sidebar for days. I've followed all of the steps so I'm not sure what's going wrong. I've tried both of the codes that Helga posted into my functions.php file in the child theme directory. No matter what, the new widget never appears in the admin area. Is there something going wrong? All I have done is add the code to the functions.php, is there another step I'm missing?

    Any help is greatly appreciated.

    Posted 2 years ago #
  17. //Widgetized sidebar Names
    
        if (function_exists('register_sidebar'))
    
        {
    
        register_sidebar(array(
    
        'before_widget' => '<div class="sidebar_widget">',
            'after_widget' => '</div>',
            'before_title' => '<h3>',
            'after_title' => '</h3>',
    
        'name' => 'YOURNAMEHERE'
    
        ));
    Posted 2 years ago #
  18. shelley,

    not sure what you are doing, b/c i just retested the code from above w/ a blank child theme and it works fine.

    function child_widgetized_areas($content) {
            $content['Header Aside'] = array(
    			'admin_menu_order' => 100,
    			'args' => array (
    				'name' => 'Header Aside',
    				'id' => 'header-aside',
                    'description' => __('The header widget area.', 'thematic'),
    				'before_widget' => thematic_before_widget(),
    				'after_widget' => thematic_after_widget(),
    				'before_title' => thematic_before_title(),
    				'after_title' => thematic_after_title(),
    				),
    			'action_hook'	=> 'thematic_aboveheader',
    			'function'		=> 'thematic_header_aside',
    			'priority'		=> 10,
    			);
    
                  return $content;
    }
    
    add_filter('thematic_widgetized_areas', 'child_widgetized_areas');
    
    // Define the Header Aside
    function thematic_header_aside() {
    	if (is_active_sidebar('header-aside')) {
    		echo thematic_before_widget_area('header-aside');
    		dynamic_sidebar('header-aside');
    		echo thematic_after_widget_area('header-aside');
    	}
    }

    1. make sure you are using the latest stable version of thematic (though i don't think it should matter in this case):
    http://developing.thematic4you.com/thematic-development-release/

    and 2. make sure that your child theme is activated (seems obvious, but i know the code works so i'm just checking)

    Posted 2 years ago #
  19. shelleyeaster
    Member

    Problem solved! I feel pretty stupid about this, but I had misspelled the "functions.php" file and I never noticed until just now. Wish I had noticed earlier! Thank you all for your help, this forum is awesome.

    Posted 2 years ago #
  20. fwunder
    Member

    Sorry to resurrect this *again*, but I got some weirdness (technical term) going on I'm sure you folks can help me out with. So, I create a widget area like below. The action hook is commented out cuz I don't want it for what I'm messing with.

    //add left aside widget and order in admin below Secondary aside
    function child_widgetized_areas($content) {
            $content['Left Aside'] = array(
    			'admin_menu_order' => 201,
    			'args' => array (
    				'name' => 'Left Aside',
    				'id' => 'left_aside',
                                     'description' => __('Left Sidebar Widget area.', 'thematic'),
    				'before_widget' => thematic_before_widget(),
    				'after_widget' => thematic_after_widget(),
    				'before_title' => thematic_before_title(),
    				'after_title' => thematic_after_title(),
    				),
    //			'action_hook'	=> 'thematic_belowcontent',
    			'function'		=> 'output_left_aside',
    			'priority'		=> 10,
    			);
                  return $content;
    }
    add_filter('thematic_widgetized_areas', 'child_widgetized_areas');
    
    // Define the Left Aside
    function output_left_aside() {
    	if (is_active_sidebar('left_aside')) {
    		echo thematic_before_widget_area('secondary-aside');
    		     dynamic_sidebar('left_aside');
    		echo thematic_after_widget_area('secondary-aside');
    	}
    }

    Now, this works perfect!! The first time! The admin widget order is just what I hoped for with "Left Aside" showing up just below "Secondary Aside". Then...I decide to start messing around with action_hook and admin_menu_order. I know I shoulda left it alone, but I couldn't help it. Anyway, the widget still works perfectly, but I lost control of admin_menu_order. I tried unsetting it, killing my cookies, resetting my browser and two glasses of cheap wine. It's stuck in the top position. Very annoying. Before I jump into phpMyAdmin to try and see where it's not working, maybe you can help?

    As usual.....thanks!

    Posted 2 years ago #
  21. fwunder
    Member

    Never mind. It's removing the 'action_hook' that's causing the problem. It's kinda interesting though. I want to display the custom widget in a custom layout that's not defined by a thematic action hook. By using the other widget register option (or removing the action_hook from the array) I can place it anywhere in my custom layout but lose admin widget sorting capability. Not sure if that makes sense, but that's what's happening.

    I'm using the widget here:

    function my_stuff_below_content() {
    // a bunch of boring stuff
       <div class="left-aside">
            <?php output_left_aside(); ?>
          </div>
    // a bunch more boring stuff
    }
    add_action('thematic_belowcontent', 'my_stuff_below_content');
    Posted 2 years ago #
  22. you can always create your own action. take a look at how thematic does it

    // Just after the opening body tag, before anything else.
    function thematic_before() {
        do_action('thematic_before');
    } // end thematic_before

    so you could conceivably do:

    function kia_loves_bacon() {
        do_action('kia_loves_bacon');
    }

    then your action hook would be

    'action_hook' => 'kia_loves_bacon'

    and where you want it in your template that you can't get to w/ thematic you'd have

    kia_loves_bacon();

    Posted 2 years ago #
  23. fwunder
    Member

    Girl!! I'm gonna buy you some bacon! How'd you get so smart? That, of course, works perfectly. Thanks again!

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.