Visualizzazione risultati 1 fino 3 di 3

Discussione: Mettere spunta automatica a checkbox

  1. #1
    Guest

    Predefinito Mettere spunta automatica a checkbox

    Ho questo codice che mette solo la casella vuota, la spunta deve essere messa a mano, io vorrei che la spunta sia predefinita.
    La stringa da modificare dovrebbe essere questa 'cookies' => '<p class="comment-form-cookies-consent">...

    Codice HTML:
    $req      = get_option( 'require_name_email' );
    	$html_req = ( $req ? " required='required'" : '' );
    	$html5    = 'html5' === $args['format'];
    	$consent  = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
    	$fields   =  array(
    'author'  => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
    '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $html_req . ' /></p>',
    'email'   => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
    '<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" maxlength="100" aria-describedby="email-notes"' . $html_req . ' /></p>',
    'url'     => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' .
    '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>',
    'cookies' => '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
    '<label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label></p>',
    Ultima modifica di albenessereblog : 05-06-2018 alle ore 06.20.52

  2. #2
    Guest

    Predefinito

    Risolto!

    Si aggiunge checked

    ...type="checkbox" value="yes" checked'...

  3. #3
    karl94 non è connesso Staff AV
    Data registrazione
    03-10-2005
    Messaggi
    17,744

    Predefinito

    Ti sconsiglio di apportare una modifica del genere: la normativa GDPR (che è il motivo dell'introduzione di quel campo in WordPress) indica espressamente che la preselezione di una casella non è ammessa come metodo per l'accettazione del consenso al trattamento dei dati personali.
    Inoltre quello è un file del core di WordPress, non è bene modificarlo: al primo aggiornamento perderai le modifiche.
    Ultima modifica di karl94 : 05-06-2018 alle ore 10.34.36

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •