Site logo

Archived topic

Customize search button icon

1 reply · Started by Adam on September 30, 2020

Viewing posts 1–2 of 2

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

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

This archived topic is closed to new replies.