-
AuthorPosts
-
October 18, 2017 at 4:04 pm #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
ColinOctober 19, 2017 at 11:49 am #866166Hey 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,
RikardOctober 19, 2017 at 12:38 pm #866188Hi 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
ColinOctober 19, 2017 at 12:41 pm #866192To 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
ColinOctober 20, 2017 at 7:08 am #866605Hi 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,
RikardOctober 20, 2017 at 10:12 am #866652Hi Rikard
Ah yes, I managed to work it out after I had updated the post.
Thanks for your help
Many Thanks
Regards
ColinOctober 21, 2017 at 6:43 am #866979Hi 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,
RikardOctober 21, 2017 at 8:38 am #866992Hi Rikard
Everything is working OK thanks. The ticket can be closed.
Many Thanks
Regards
ColinOctober 21, 2017 at 9:15 am #866994And 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 screenadd_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' ); }
October 21, 2017 at 9:17 am #866995Hi Guenni007
That’s very helpful, thank you.
Regards
ColinOctober 21, 2017 at 10:41 pm #867116 -
AuthorPosts
- The topic ‘Add 2 widget areas to header’ is closed to new replies.