Skip to content

Instantly share code, notes, and snippets.

@wvega
Last active December 19, 2015 22:58
Show Gist options
  • Save wvega/6031134 to your computer and use it in GitHub Desktop.
Save wvega/6031134 to your computer and use it in GitHub Desktop.
<?php
echo $before_widget . $before_title . $title . $after_title;
echo '<div align="center">';
echo '<form method="post" action="'. url_searchads() .'" onsubmit="if (this.keywordphrase.value == \'Search by keyword\') { this.keywordphrase.value = \'\'; } return true;">';
echo '<input type="hidden" name="a" value="dosearch"/>';
$keywordphrase = stripslashes_deep(awpcp_post_param('keywordphrase'));
if ($instance['show_keyword'] == 1) {
echo '<label for="awpcp-search-keywordphrase">' . __('Search by keyword', "AWPCP") . '</label><br/>';
// if keywordphrase is empty, the place holder string is printed as the field's value,
// otherwise the value entered by the user will be printed.
if ( empty( $keywordphrase ) ) {
echo '<input id="awpcp-search-keywordphrase" type="text" name="keywordphrase" value="Search by keyword" onblur="if (this.value == \'\'){this.value = \'Search by keyword\'; }" onfocus="if (this.value == \'Search by keyword\') {this.value = \'\'; }">';
} else {
echo '<input id="awpcp-search-keywordphrase" type="text" name="keywordphrase" value="' . esc_attr($keywordphrase) . '" onblur="if (this.value == \'\'){this.value = \'Search by keyword\'; }" onfocus="if (this.value == \'Search by keyword\') {this.value = \'\'; }">';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment