[Resolved] Adding a button to header

Home Forums Support [Resolved] Adding a button to header

Home Forums Support Adding a button to header

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #128292
    bbrdavid

    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.

    #128310
    Tom
    Lead Developer
    Lead Developer

    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 πŸ™‚

    #128314
    bbrdavid

    Awesome, Tom! And I even understand it…guess I’m learning πŸ™‚

    #128316
    Tom
    Lead Developer
    Lead Developer

    Awesome! πŸ™‚

    #213729
    Rylan Urban

    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)

    #213740
    Tom
    Lead Developer
    Lead Developer

    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
    #213772
    Rylan Urban

    Perfect πŸ™‚

    DIdn’t know that code existed!

    #213775
    Tom
    Lead Developer
    Lead Developer

    Glad I could help πŸ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.