Home › Forum › Plugin e temi di WP › Valori di comment_id_fields
-
AutorePost
-
-
24 Settembre 2010 alle 5:36 #15081dalzianiPartecipante
Buongiorno a tutti,
la funzione comment_id_fields dichiarata in comment-template.php
restituisce, a quanto ho capito, due valori.
function comment_id_fields() {
global $id;
$replytoid = isset($_GET) ? (int) $_GET : 0;
echo “<input type=’hidden’ name=’comment_post_ID’ value=’$id’ id=’comment_post_ID’ />n”;
echo “<input type=’hidden’ name=’comment_parent’ id=’comment_parent’ value=’$replytoid’ />n”;
}
Avrei bisogno di richiamare dal mio tema accessibile il valore della variabile $replytoid, come posso fare?
Grazie in anticipo, Francesco
-
24 Settembre 2010 alle 8:45 #77237SteveAglAmministratore del forum
Contestualizza il tutto, cosa vuol dire devo richiamare, dove? nella stessa pagina dove ci sono i commenti? Per fre cosa… ?
-
25 Settembre 2010 alle 16:11 #77244dalzianiPartecipante
Ciao SteveAgl,
ho creato un tema accessibile per WordPress, puoi visualizzare il risultato a http://opere.4elementi.info
Per ottemperare al criterio 3.3.6 della linee guida Wcag 2.0 ho inserito una pagina (sendmail.php) che – con un form – acquisisce i dati inseriri dall’utente in comments.php, gli permette di rvisualizzarli e correggerli prima di inviarli e (al click) li invia a wp-comments-post.php.
Non fa parte della hierarchy di WordPress, per cui è “inerte” nel senso che non può gestire le funzioni, può solo ricevere dati, inserirli in variabili e inviarli.
Tutto ha funzionato sinchè ho deciso di aggiungere al tema l’opzione dei commenti annidati (threaded comments), per cui comments.php deve utilizzare la funzione
<?php comment_id_fields(); ?>
Non potendo usarla nella pagina inerte sendmail.php devo acquisire i valori che genera, uno lo ho già
<input type=”hidden” name=”comment_post_ID” value=”<?php echo $id; ?>” />
vorrei ricavare
“<input type=’hidden’ name=’comment_parent’ id=’comment_parent’ value=’$replytoid’ />,
magari richiamandola da comment-template.php, forse utilizzando functions.php del tema.
Come faccio?
Grazie in anticipo, Francesco
-
4 Ottobre 2010 alle 5:56 #77405dalzianiPartecipante
Ciao,
la soluzione in effetti era semplice: inserire in comments.php tra i campi nascosti del form sotto il pulsante Invia una stringa che crea un campo nascosto il cui valore è la stessa funzione che genera il valore della variabile in comment-template.php
<input type=”hidden” name=”comment_parent” id=”comment_parent” value=”<?php echo isset($_GET) ? (int) $_GET : 0; ?>” />
Poi il valore del campo viene richiamato in una variabile $replytoid nella pagina “inerte” sendmail.php con il metodo
$replytoid=$_REQUEST;
attraverso il nome del campo nascosto, poi inviato a wp-comments-post.php allo stesso modo, un campo nascosto il cui valore è la variabile $replytoid
<input type=”hidden” name=”comment_parent” value=”$replytoid”/>
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.