Questo è il codice php che ho in WordPress, vorrei mettere il placeholder nel campo email.
Mi spiego meglio: il placeholder appare già ma come $value, non come placeholder.
Mi spiego meglio: il placeholder appare già ma come $value, non come placeholder.
PHP:
// allow remote setting of email in form
if ( isset( $_REQUEST['email'] ) && is_email( $_REQUEST['email'] ) ) {
$value = $this->sanitize_email( $_REQUEST['email'] );
} elseif ( 'true' === strtolower( $args['nojs'] ) ) {
$value = '';
} else {
$value = __( 'Inserisci l'email...', 'subscribe2' );
// build default form
if ( 'true' === strtolower( $args['nojs'] ) ) {
$this->form = '<form name="s2form" method="post"' . $action . '><input type="hidden" name="ip" value="' . esc_html( $_SERVER['REMOTE_ADDR'] ) . '" />' . $antispam_text . '<p><label for="s2email">' . __( 'Tua email (non verrà pubblicata):', 'subscribe2' ) . '</label><br /><input type="email" name="email" id="s2email" value="' . $value . '" size="' . $args['size'] . '" />' . $wrap_text . $this->input_form_action . '</p></form>';
} else {
$this->form = '<form name="s2form" method="post"' . $action . '><input type="hidden" name="ip" value="' . esc_html( $_SERVER['REMOTE_ADDR'] ) . '" />' . $antispam_text . '<p><label for="s2email">' . __( 'Tua email (non verrà pubblicata):', 'subscribe2' ) . '</label><br /><input type="email" name="email" id="s2email" value="' . $value . '" size="' . $args['size'] . '" onfocus="if (this.value === \'' . $value . '\') {this.value = \'\';}" onblur="if (this.value === \'\') {this.value = \'' . $value . '\';}" />' . $wrap_text . $this->input_form_action . '</p></form>' . "\r\n";
}
$this->s2form = apply_filters( 's2_form', $this->form );
}