Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #865775

    Hi

    I’m building a new site and I need a widget area either side of the centered Logo. I have one widget area to the right of the logo successfully by using:

    add_action( 'ava_after_main_menu', 'enfold_customization_header_widget_area' );
    function enfold_customization_header_widget_area() {
    	dynamic_sidebar( 'header' );
    }

    However I don’t seem to be able to add a second widget area. When I copy the code above and change the line “dynamic_sidebar( ‘header’ )” to “dynamic_sidebar( ‘telheader’ )” All my pages become blank white.

    What am I doing wrong?

    Many Thanks
    Regards
    Colin

    #866166

    Hey Colin,

    You should be able to use this if you want to register more than one widget in the header, just make sure the name of the sidebar is the same as what has been registered:

    add_action( 'ava_after_main_menu', 'enfold_customization_header_widget_area' );
    function enfold_customization_header_widget_area() {
    	dynamic_sidebar( 'header1' );
            dynamic_sidebar( 'header2' );
    }

    Best regards,
    Rikard

    #866188

    Hi Rikard

    That’s great thanks. I now have two widget areas. But for some reason I cannot format the new widget with CSS

    The original header widget is targeted with:

    #header .widget {
     left: 50%;
     padding-top: 15px;
     position: absolute;
     top: -120px;
    	width: 50%;
    	height: auto;
    	padding-right: 60px;
    } 

    but if I target the second widget area with

    #header1 .widget {
     padding-top: 15px;
     position: absolute;
     top: -120px;
    	width: 50%;
    	height: auto;
    	padding-right: 0px;
    } 
    #header1 .widget p {
    	font-size: 27px;
    	line-height: normal;
    	text-align: left;
    	color: #ffffff;
    	font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
      font-weight: 600;
    	float: left;
    } 
    

    nothing happens

    Do I need to do something else aprt from adding the code to functions.php

    Many Thanks
    Regards
    Colin

    #866192

    To be clear I have created the widget area HEADER1 and I can see the text I have entered on the home page in the header. but I just cannot format it at the moment

    Many Thanks
    Regards
    Colin

    #866605

    Hi Colin,

    The #header element is the default header element and not the actual widget, if you want to target them individually you will have to find out the widget ID. You can do so by inspecting the element in question in your browser. If you need help with that then please link to your site so that we can have a closer look.

    Best regards,
    Rikard

    #866652

    Hi Rikard

    Ah yes, I managed to work it out after I had updated the post.

    Thanks for your help

    Many Thanks
    Regards
    Colin

    #866979

    Hi Colin,

    Great, glad you got it working. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #866992

    Hi Rikard

    Everything is working OK thanks. The ticket can be closed.

    Many Thanks
    Regards
    Colin

    #866994

    And by the way all concerns to the same hook ( ava_after_main_menu) this is the elegant method – but if you like to add to a different hook ( not only the ava_after_main_menu ) in the header area you only have to change the functions name.
    A function needs to be bijective – one-to-one , if not you got your white screen

    add_action( 'ava_after_main_menu', 'enfold_customization_header_widget_area' );
    function enfold_customization_header_widget_area() {
    	dynamic_sidebar( 'header' );
    }
    
    add_action( 'ava_main_header', 'a_different_function_name' );
    function a_different_function_name() {
    	dynamic_sidebar( 'headertel' );
    }
    #866995

    Hi Guenni007

    That’s very helpful, thank you.

    Regards
    Colin

    #867116

    Hi,
    Glad to hear you got it sorted out, we will close this now. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Add 2 widget areas to header’ is closed to new replies.