Add header widget area
-
I want to add a widget area to the header area to the right of my logo, how would I go about doing this?
-
This is possible but would require some code work based on the theme in use.
Start here (review the links also:
you can do that by yourself without using any plugin .. with an html code . i recently had the same question you are posting
<div style="min-width:99%; max-width:99%; width:100%;"> <span style="float:left;"> logo here( on left ) </span> <span style="float:right;"> put any html or php code here , aligned to right </span> </div>
hope u fix that ??
Thanks PVWD, E&G..
I’ve taken a look through that widgetiziting document before for other information, great post.. I just thought there has to be an easier way though…
I’ve chosen to simply implement the div that E&G suggested with a javascript/text code, but if you take a look: https://homehealthyfitness.com , it hasn’t worked out exactly according to plan…
I’m trying to make it adjacent to my header image and it also moved my search button!
I tried placing it in various spots in the header.php but with no desirable outcome…
hello , i am so sorry i could not understand all your reply , am kind of newbie to this but , if you just want to make your header elegant :
make the logo and 728×90 google banner look inline in the same line, you may want to reduce the size of your logo , and use my code.
first , try to erase that search toggle from header.php .
then erase all concerning the logo and ad , then put this code ( after making a backup ) :<div style="min-width:99%; max-width:99%; width:100%;"> <span style="float:left;"> <a href="/" title="HomePage"><img src="https://homehealthyfitness.com/wp-content/uploads/2014/05/HomeHealthyFitness_CustomLogoDesign_sm13.png" width="300" height="90" alt="Home Healthy Fitness: Bringing good and fitness to your home"></a> </span> <span style="float:right;"> <!-- put your google ad code for 728x90 banner --> </span> </div>
i gived your site a try , check the screen shot.
i currently use that div code in my site’ headerThat worked awesome! Thank you so much, been meaning to fill that spot for some time now lol, really appreciate it!
oh great i see your logo fits with the banner now .. good you are so welcome ??
Hi I was wanting to do this, as well, but I have a rotating header code added to my site. I want to change the layout quite a bit actually and want to have a widget area next to the new style header but will still be using about 15-20 images that are selected randomly every time a person lands on the site or refreshes. Can I use this code for that and if so, where would I put it?
Hello @blue,
sorry for this late reply but i just found out you left a reply.
link to your site &/or theme = priceless !Hi guy,
I need your help if possible. You seem to be quite confident with header and widgets.
I would like to have a currency widget (which I already have) on the header of my site, in order to be visible in every single pages:website: debruir.com
theme: xmarketI have followed the instructions written in the following post but I never succeed:
I have pasted the following codes in my function.php:
<?php // Add a widget. if (function_exists('register_sidebar')) { register_sidebar(array( 'name' => 'Extra Widget Before Header', 'id' => 'extra-widget', 'description' => 'Extra Widget Before Header', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>' )); } // Place the widget before the header add_filter ('before_navbar', 'add_my_widget'); function add_my_widget() { if (function_exists('dynamic_sidebar')) { dynamic_sidebar('Extra Widget Before Header'); } }
By doing this operation I can see “Extra Widget Before Header” on my WordPress dashboard but, whenever I drag and drop any widgets in the “Extra Widget Before Header” container, it wont work on the front end of my website.
Am I doing anything wrong?
I appreciate your attention guys and I hope I can finally solve this issue.Thanks
Hi guys,
Sorry to disturb you again I have just managed to add the widget in a better place than before but I still would like to know if it is possible to place the widget area beside my logo.Just for the record I have added the following code to get what I have at the moment:
In functions.php:
//add a widget area in the header as described by TomHart if ( function_exists ('register_sidebar') ) register_sidebar( array( 'name' => __( 'Header Widgets Area', 'twentythirteen' ), 'id' => 'sidebar-header', 'description' => __( 'Header widgets area for my child theme.' , 'twentythirteen' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) );
and in header.php:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Header Widgets Area') ) : endif; ?>
Thanks again.
Hello there!
what you did is which is a good thing, you have registered a new sidebar where you can place widgets through wp-admin/widgets.php and now all you need is to use some CSS to keep the logo banner and your widget content displayed inline.. once you have added what you want to add, look into your source code and apply some CSS.. you can try the following.
this is some of your header code :
<header id="header"> <div class="logo"> <img .. /> </div> <div class="clear"></div> </header>
Your logo has this style :
width: 38%; text-align: left;
now what you need to do is, add the registered sidebar before the clearing div (
<div class="clear"></div>
), and associate some CSS style to it so that it appears online with logo, and floated to the right, like the following:float: right; width: 60%;
All :
<header id="header"> <div class="logo"> <img .. /> </div> <div id="header-sidebar" style="width: 60%;float: right;"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Header Widgets Area') ) : endif; ?> </div> <!-- #header-sidebar --> <div class="clear"></div> </header>
let me know if it worked, or if you needed further assistance ??
p;ease I want to add a slideshow widget to a theme which did not provide for header widget. Can anybody help ?
please I want to add a slideshow widget to a theme which did not provide for header widget. Can anybody help ?
@ceap : everything is possible dude.
and what is your url ? theme used ? etc ..
and how do you plan to insert the slider ? i guess you use slideshow plugin which will give you a shortcode by the end..
feed-backs on this please ??I’m also trying to add a widget to the right side of my header so I can add a linked phone number and email. Any help would be greatly appreciated! Website: https://lesliefife.org/ Theme Used: MH Magazine
@lrensi – try asking on the forum for the theme you are using – start a new thread there:
https://www.ads-software.com/support/theme/mh-magazine-lite#postform
- The topic ‘Add header widget area’ is closed to new replies.