Creating wordpress shortcode

PHOTO EMBED

Tue Mar 15 2022 00:31:04 GMT+0000 (UTC)

Saved by @zildjianjaxolis #php #wordpress

/**
* Usage [gift_registry_search_form]
*/
add_shortcode( 'gift_registry_search_form', 'gift_registry_search_form' );
function gift_registry_search_form( $atts )
{
    ob_start();
    ?>
        <div class="gift-registry-search-form">
            <h1>Find a Gift Registry</h1>
            <input type="text" name="gift_registry_first_name" id="gift_registry_first_name" placeholder="Search by first name" />
            <input type="text" name="gift_registry_last_name" id="gift_registry_last_name" placeholder="Search by last name" />
            <input type="text" name="gift_registry_email" id="gift_registry_email" placeholder="Search by email" />
            <button class="search-registry-button">Search</button>
        </div>
    <?php
    $output = ob_get_contents();
    ob_end_clean();

    return $output;
}
content_copyCOPY