EDCARTECH IT WORLD

Getting You More Closer ...

Downloads

Downloads

Software,Script,Templates
Themes and Plugins for you, just Download them.

Learn

Tech & Programming

Quick start learning more tech tips and basic software development

Systems

Ed Systems

Both free and paid Edcartech systems with "self Demonstration".

How to create a custom Header widget in wordpress

Posted by
/ / Leave a comment

Have you ever felt the need to create your own custom header element and position it at any place of your choice in the header section of a WordPress blog or website ? If your answer is yes then don’t go anywhere yet. your answer might be right here.
let’s go straight to it.
NB: MAKE SURE YOUR ARE CONVERSANT WITH EDITING YOUR WORDPRESS THEME FILES IF NOT YOU MIGHT BE LOOKING FOR A PLUGIN TO DO THIS MAGIC WE ARE ABOUT TO PERFORM.

1. Kindly open your theme function.php file and paste the code right below it and save.
Please make sure you find no errors whilst saving your file.

The code above will automatically create a hook in WordPress to register a custom widget for you. to access this widget you can move to appearance menu on your left and click on Widgets ie. Appearance>>>Widgets.
In there you will see the newly created custom widget as the same name above. Custom Header Widget Area. Now add whatever you want to display in the custom header section of your site.

2. You will not be able to see the newly created header if you don’t complete the magic by implementing the below code in the the theme’s header.php ie. This could also be a custom header in your theme’s directory so please make sure you target the right section.

after pasting exactly this code you can now save or update the file without error.

3. At this point be sure to have done the most important part of the work. Refresh you site or blog to see the changes being effected.
you need to play around with some CSS to make sure you place the element at the right place, the CSS snippet below might help you to go the right direction.

I hope you have what you want. Enjoy yourself and happy coding…

Edcartech

Leave a comment