Archived topic
Adding a button to header
7 replies · Started by bbrdavid on August 10, 2015
I'd like to put a button in the middle of the header just like in the wpcurve.com homepage.
Would I do this with hooks? Could you point me to some sample code? Thanks very much, sorry if this is a very basic question.
Hi there,
You could do this using hooks, the Page Header add-on or the Sections add-on.
You would first add the HTML for the button:
<a class="custom-button" href="https://generatepress.com">GeneratePress</a>
Then you would have to style that button:
.custom-button,
.custom-button:visited {
display: inline-block;
padding: 5px 10px;
border: 2px solid #FFF;
}
.custom-button:hover {
background: #000;
color: #FFF;
}
Adjust as needed :)
Awesome, Tom! And I even understand it...guess I'm learning :-)
Awesome! :)
How can I get the button centered on the whole header, no just the text area?
like on http://voyagesolarenergy.com
the button is centered under the text.
I want it centered under all of of the text + logo
(currently placed in after-header content hook)
Since the elements are set to display: inline-block, they'll do their best to fill in the spaces.
If you want it to clear below those two elements, you need to add a clear element above the button:
<div class="clear"></div>
button HTML here
Perfect :)
DIdn't know that code existed!
Glad I could help :)
