[Support request] Customize search button icon

Home Forums Support Customize search button icon

  • This topic has 1 reply, 2 voices, and was last updated 5 months ago by David.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1466351
    Adam

    Can you tell me how to customize the searchform.php to have a custom icon for the search button?

    #1466817
    David
    Staff
    Customer Support

    Hi there,

    Searches need to be output as form and requires some PHP – to use that in a Header Element you will need to create a shortcode – heres an example:

    add_shortcode( 'searchform', function() {
        ob_start();
        ?>
        <form method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>">
            <input type="search" class="border-0" placeholder="Search" value="" name="s" title="Search for:">
            <input type="image" src="add_you_search_image_url_here" alt="Submit" />
        </form>
        <?php
        return ob_get_clean();
    } );

    Add that PHP snippet to your site to create the Shortcode: [searchform] that you can add to your Header Element.

    It will require some CSS to style

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